Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

node_modules not included in layers #163

Open
naveen-murali opened this issue Mar 10, 2024 · 7 comments
Open

node_modules not included in layers #163

naveen-murali opened this issue Mar 10, 2024 · 7 comments

Comments

@naveen-murali
Copy link

Issue Description:
After upgrading to version v2.8.5 of serverless-layers, the plugin fails to include the node_modules directory in its generated layers.

Steps to Reproduce:

  1. Upgrade serverless-layers to v2.8.5.
  2. Deploy a serverless application that utilizes layers.
  3. Verify the contents of the deployed layers.

Expected Behavior:
The layers should contain the node_modules directory, including all dependencies required by the specified packages.

Actual Behavior:
Upon inspection of the deployed layers, we can see that the node_modules directory is missing.

Workaround:
Reverting to version v2.7.0 of serverless-layers resolves the issue, as the node_modules directory is correctly included in the generated layers.

Environment:

  • Serverless Framework version: 3.38.0
  • Node.js version: 18.17.1
  • NPM Version: 9.6.7

Screenshot:
example
Here you can observe that the total layer size is much less than it should be.

@sabotageivet123
Copy link

Same here. The latest version generates a layer without node_modules, it contains just package-lock.json file.

@JoseFortunato
Copy link

Same here. I downgrade version and its working fine...

@rsi-mrobinson
Copy link

Same here, downgraded to 2.7.0. I also saw an sdk error on the latest version when trying to run serverless deploy

... ○ Created layer package /path/to/Developer/packages/api/.serverless/layer.zip (0.2 MB)
... ○ Uploading layer package...
... ○ OK...
ServerlessLayers error:
    Action: Lambda:publishLayerVersion
    Params: {"Content":{"S3Bucket":"mybucket","S3Key":"serverless/blah/blah/layers/layer.zip"},"LayerName":"layername","Description":"created by serverless-layers plugin (123456789)","CompatibleRuntimes":["nodejs"],"CompatibleArchitectures":["x86_64","arm64"]}
AWS SDK error:
    Could not find API configuration lambda-2015-03-31

@jeanoliveira92
Copy link

jeanoliveira92 commented Mar 21, 2024

Im too. I have the same problem. I downgraded too to 2.7.0 and still showing error on deploy =(

... ○ Uploading layer package...
... ○ OK...
ServerlessLayers error:
Action: Lambda:publishLayerVersion
    Params: {"Content":{"S3Bucket":"serverless","S3Key":"serverless/service/dev/layers/altu-service-dev-nodejs-serverless.zip"},"LayerName":"altu-service-dev-nodejs-serverless","Description":"created by serverless-layers plugin (1170cc4a8683d81ff4c3125ba5f45457)","CompatibleRuntimes":["nodejs20.x"],"CompatibleArchitectures":["x86_64","arm64"]}
AWS SDK error:
    Could not find API configuration lambda-2015-03-31
error
Running "serverless" from node_modules

@agutoli help us please. The project stop to upload beacause this problem. Sorry and thanks ^^

Updated: @rsi-mrobinson i changed the "serverless-layers" from devDependencies to dependencies and set the version to "2.7", yes without the third number and worked to me! \O/

@rajeevbbqq
Copy link

If anyone is facing issues even after downgrading to 2.7.0 then cross-check package.json by

serverless-layers: 2.7.0 remove ^ from serverless layers if it is there!

@OmarKhattab
Copy link

Related to #166

@fl-wxiao
Copy link

I made localized modifications to the source code. This is not safe, but at least it will not prevent the normal deployment of the service.

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

No branches or pull requests

8 participants