AWS Error: Function code combined with layers exceeds the maximum allowed size of 262144000 bytes
See original GitHub issueIssue
Just dropping this down somewhere to note / for people with this problem. Not sure if it’s a bug or expected behaviour.
I tried to introduce serverless-layers
to my existing project and got:
An error occurred: *** - Function code combined with layers exceeds the maximum allowed size of 262144000 bytes
The zip of the code was now only 40kb and the layer 40mb (150mb decompressed). However the previous bundle code size was pretty large and I think CloudFormation was trying to first apply the layer to the function before updating the function code which resulted in the error above.
Workaround
I deleted the stack and re-created it. An alternative (although not tested) update the code to something with no imports deploy. Once successful try and add layers to the project.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:14 (1 by maintainers)
Top Results From Across the Web
How to increase the maximum size of the AWS lambda ...
The total unzipped size of the function and all layers can't exceed the unzipped deployment package size limit of 250 MB.
Read more >Lambda layers exceed quota - how to fix? | AWS re:Post
When add layers (Python libraries in my case) to a Lambda Function, I receive the below ... "Layers consume more than the available...
Read more >Using layers with your Lambda function - AWS Documentation
The total unzipped size of the function and all layers cannot exceed the unzipped deployment package size quota of 250 MB. For more...
Read more >ML Code vs AWS Lambda Limits - Medium
... we were stuck getting the deployment error: “An error occurred: Function code combined with layers exceeds the maximum allowed size of 262144000...
Read more >Cannot deploy a 64MB lambda package : r/aws - Reddit
ScreenshotLambdaFunction - Function code combined with layers exceeds the maximum allowed size of 262144000 bytes. The actual size is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ptimson I found a different workaround that might be slightly better, but still requires downtime of the service. I commented out following lines after each function:
for all of my functions. This was my one change and I deployed like this once. Once that deployed successfully I added those lines back and was able to deploy again.
+1
Solution that worked for me: - Remove/Comment lambda layer refs in function declaration - Deploy - Add/Uncomment lambda layer refs in function declaration