is huge (node.js)

I have a small serverless project I started recently with node.js on AWS. It currently has 6 functions.

When packaged, each of those functions is between 50 and 800 KB.

I have 3 dependencies installed via npm, and 8 dev-dependencies, one of which is the aws-sdk.

However, in the .serverless folder there is another zip called It is 49MB. Unzipped, it is 300MB, which causes CloudFormation to fail. It appears to be fully generated by the framework. The contents of this zip are as follows:

  • apiGatewayCloudWatchRole (folder, 2KB)
  • cognitoUserPool (folder, 10KB)
  • eventBridge (folder, 7KB)
  • s3 (folder, 7KB)
  • node_modules (folder, 49MB)
  • package.json (file, 1KB)
  • utils.js (file, 3KB)
  • (file, 1KB)

This particular node_modules folder contains a single module, which is my entire project directory, which contains my entire node_modules file including all dependencies.

I’m pretty sure that shouldn’t be uploaded, especially since it also includes my .idea/ folder which is supposed to be excluded with

  individually: true
    - '*.iml'
    - .idea/**

Is this supposed to happen?

Hey there. I just faced the same issue. Did you figure out a solution?

It should be fixed in version 1.53.

I have the same bug in v1.66.0. Other dependencies are serverless-offline and serverless-webpack.