Giter Club home page Giter Club logo

Comments (7)

Willis0826 avatar Willis0826 commented on July 28, 2024 3

Thanks, @ElChapitan and @r-token. Setting the resolveExtensions did solve the problem.
I'm using Serverless TypeScript with the following setup.

import type { AWS } from '@serverless/typescript';
const serverlessConfiguration: AWS = {
  custom: {
    esbuild: {
      bundle: true,
      minify: true,
      sourcemap: false,
      exclude: ['aws-sdk'],
      resolveExtensions: ['.ts', '.js', '.mjs'],
      target: 'node20',
      platform: 'node',
      concurrency: 10,
    }
  }
}

from serverless-plugin-warmup.

juanjoDiaz avatar juanjoDiaz commented on July 28, 2024

Hi @r-token ,

I need more details about your setup.
Specifically, about other plugins that you are using.

The issue that you are getting is because you are using a plugin to compile to your code (I assume that from Typescript) and it's trying to compile the warmup lambda.

The order in which you declare the plugins matters.
Have you tried declaring the warmup plugin after the compilation plugin?

from serverless-plugin-warmup.

r-token avatar r-token commented on July 28, 2024

Hey @juanjoDiaz, great info - I'm sure you are correct. I am using serverless-esbuild, though declaring the warmup plugin after esbuild did not resolve the issue.

serverless-esbuild allows you to exclude files from its build step. Where is that warmUpPluginDefault declared? Hopefully I can just exclude that file and that will resolve it.

from serverless-plugin-warmup.

r-token avatar r-token commented on July 28, 2024

@juanjoDiaz I was able to resolve this with the following steps:

  1. Add a custom esbuild config file that supports mjs file extensions. By default only js and ts are supported.

That fixed the initial error and it could compile that file properly, but I was then getting an error saying .warmup/default/index.mjs:4:44: ERROR: Could not resolve "@aws-sdk/client-lambda".

So step two was:

  1. Install @aws-sdk/client-lambda as a dev dependency.

I was then able to deploy successfully with v8.3.0.

Thank you for the help here! If this is an acceptable resolution then I think we can consider this issue closed.

from serverless-plugin-warmup.

ElChapitan avatar ElChapitan commented on July 28, 2024

Hey @r-token , just ran into this problem myself. Any chance you can share some of the config setup you needed to make in order to get it to run?

from serverless-plugin-warmup.

ElChapitan avatar ElChapitan commented on July 28, 2024

For those coming to this later and needing some more info:

I added an esbuild.config.js with this:

module.exports = () => ({
  external: [],
  resolveExtensions: ['.ts','.js','.mjs']
});

And modified my serverless.yaml like this:

custom:
  esbuild:
    config: './esbuild.config.js'

from serverless-plugin-warmup.

ElChapitan avatar ElChapitan commented on July 28, 2024

As a follow up for those coming after, that worked for me as well.

from serverless-plugin-warmup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.