rahulserver
rahulserver

Reputation: 11205

sam deploy Unzipped size must be smaller than 262144000 bytes

In my node js lambda sam app, I am getting this error: Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes"

On searching more SO posts, I get that we have to either use individual: true as here Or we have to exclude node_modules as given here

But my issue is that I am using template.yml, instead of serverless.yml which does not support package attribute and I get this error:

Error: Failed to create changeset for the stack: sam-app, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Invalid template property or properties [package]

So how do I exclude node_modules or use individual: true in my case to reduce the zip size?

Upvotes: 0

Views: 464

Answers (1)

Aaron Stuyvenberg
Aaron Stuyvenberg

Reputation: 3777

Both of the linked answers are for the Serverless Framework, and won't work with SAM.

SAM doesn't have a dedicated packaging configuration. This is a known issue which AWS has decided to not tackle, but rather delegate to npm.

There are several workarounds in the github issue, but you might want to explore using a .npmignore file. This is similar to .gitignore, and lets you specify files or file globs to ignore.

You can learn more here

Upvotes: 1

Related Questions