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

Missing folders in warmup lambda once deployed on newer serverless versions #344

Closed
haywiremk opened this issue Oct 6, 2023 · 3 comments

Comments

@haywiremk
Copy link

I am now seeing the following error using the warmup plugin
{
message:"Error: Cannot find module './serverless_sdk/index.js'
Require stack:

  • /var/task/s_warmUpPluginDefault.js
  • /opt/sls-sdk-node/wrapper.js
  • /var/runtime/index.mjs"
    name:"Runtime.ImportModuleError"
    type:"ERROR_TYPE_UNCAUGHT"
    }

When I look at the warmup-plugin-default lambda I do not see the ./serverless_sdk or ./.warmup folders. I think something may have changed in the newer serverless frameworks. I now only see the s_warmUpPluginDefault.js being deployed to the lambda. Not sure how to resolve this other than disable the plugin.

Framework Core: 3.35.2 (local) 3.35.2 (global)
Plugin: 7.0.5
SDK: 4.4.0

@juanjoDiaz
Copy link
Owner

Hi @haywiremk ,

What did you change to start seeing this?
The Framework version? The SDK version?

This kind of issue are almost always caused by different plugins not playing along nicely due to unclarity on which lifecycle events plugins should use (I've complain to the serverless maintainers about this for years...).

When talking about SDK, are you talking about the Dashboard SDK?
Sometime ago we had #310 which might be related.

@MrPeker
Copy link

MrPeker commented Oct 15, 2023

Hi,

I encountered the same problem you described, which seems to stem from the Serverless Dashboard SDK. Specifically, the SDK's wrapper function attempts to access a file in the serverless_sdk folder. Because this folder isn't included in the deployed package, it triggers an error.

As a temporary solution, I changed the packaging configuration to include all files, using the following settings:

package: { individually: false, patterns: ['**'] }

@juanjoDiaz
Copy link
Owner

Glad to found a work around.

Please keep in mind that '**' is adding the entire folder to the package.
If you do that, you probably don't want to package individually.
If you package individually you probably want more specific selectors. From the linked issue:

      patterns:
          - "!../**"
          - "!../../**"
          - ./serverless_sdk/*
          - ./s_warmUpPluginDefault.js

Closing this for now as there is much more that I can do here.

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