Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warm up plugin webpack bundling issue #337

Closed
Bhirahaspathi-Sairam opened this issue Feb 2, 2023 · 5 comments
Closed

warm up plugin webpack bundling issue #337

Bhirahaspathi-Sairam opened this issue Feb 2, 2023 · 5 comments

Comments

@Bhirahaspathi-Sairam
Copy link

Bhirahaspathi-Sairam commented Feb 2, 2023

I am using serverless warm up plugin in my project and it fails while bundling with webpack. I am not sure what the issue is.Below is the configs

 warmup:
    default:
      cleanFolder: false
      memorySize: 256
      name: ${self:service}-${self:custom.stage}-warmer
   
      events:
        - schedule: 'cron(0/5 8-17 ? * MON-FRI *)'
      timeout: 20
      verbose: true
      logRetentionInDays: 14
      prewarm: true
      concurrency: 5

I have enabled warmup at function specific level.

Here is the output from jenkins

WarmUp: Creating warmer "default" to warm up 5 functions

Bundling with Webpack...

ERROR in ../../../.warmup/default/index.js 6:12-45

Module not found: Error: Can't resolve '@aws-sdk/client-lambda' in '/.warmup/default'

Can anyone tell me why its happening

@juanjoDiaz
Copy link
Owner

Hi @Bhirahaspathi-Sairam,

You need to declare the warmup plugin after the webpack plugin to avoid it being transpiled as it is not needed.

Cheers!

@andrzej-hanusek-tg
Copy link

@juanjoDiaz I have declared warmup plugin after the webpack plugin but still getting this issue 🤔 .

@juanjoDiaz
Copy link
Owner

Hi @andrzej-hanusek-tg ,

I get a lot of these and it's always something to do with the different bundling pluging using different lifecycle hooks.
Which also impacted by the order in which you declare the plugins.

I have no idea of which bundling plugin you are using, in which order you are declaring the plugins, which versions are you using, etc.
So I need more context if you need help. A sample project where I can reproduce the issue is the faster way.

I can't do anything about webpack plugin lifecycle hook.
You might want to install @aws-sdk/client-lambda as a dev dependency so webpack can do the bundling (even if warmup then ignores the bundled version of the lambda) or configure it as a external dependency that webpack should try to bundle as it is installed globally in the lambda.

@andrzej-hanusek-tg
Copy link

@juanjoDiaz Downgrading plugin to the 8.1.0 helps.

@juanjoDiaz
Copy link
Owner

That's because 8.2 changes the runtime of the plugin to node 18 which uses the new serverless SDK.

As said, you can add @aws-sdk/client-lambda as a dev dependency and the error should go away.
However, the issue is still that the webpack plugin shouldn't be bundling the warmer lambda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants