- Newest
- Most votes
- Most comments
Hi,
Are you using Python in your Lambda?
If yes, I suggest you to read this excellent post: https://medium.com/@jolodev/my-pain-with-serverless-and-aws-lambda-52278429ae33
It explains very well how your total size is not only your code by the standard packages deployed by Lambda runtime (as layers for some of them). It also explains how to avoid their deployment when you don't need them.
The size of those packages changes as they get updated to new versions. They may get smaller or bigger depending of the goals of the version (optimization vs new features). So, when they get bigger, the total size may exceed the limit imposed by Lambda version. And then you get the message that you report,
So, the advice is to configure your Lambda runtime with minimum packages so that you stay away from this limit.
Best,
Didier
Thanks for the response! This is a good tip but does not explain why deploying the exact same thing works normally and on some days doesn't. I am mainly using node.js and some small python functions that do not play a role in this issue.
The reason you're experiencing this issues is likely caused by your use of Lambda Layers. Per the Lambda Quotas documentation, the maximum unzipped size of a function - including all layers and/or custom runtimes - is 250MB. The number of bytes reported in the error message includes not just your ZIP file, but also the layers your function is using.
I suspect that whatever layers are being included alongside your function are changing between deployments, and the total size of your function and its layer and runtime dependencies is running close to the maximum size.
Relevant content
- asked 3 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 months ago

Are you using Lambda Layers as part of your function configuration?
Yes I am using multpile Lambda Layers for each function to reduce deployment size. Today is one of those days where deployment doesn't work. No changes made.
Are any of the version numbers of the referenced layers changing between deployments?
We had this problem with a python app that needed .venv libraries. What we noticed is that the .venv contained a 'lib' and a 'lib64' folder that was a symlink to lib. The zip command follows symlinks explicitly and there is no option to prevent the behavior. The gist of the problem is that the zipped application showed a size much smaller than the size of the application on disk, but extracting the zipfile showed 'lib64' having the same size as 'lib' (it was extracted as a folder and not a symlink). The issue is somewhat difficult to identify because the zip file size is small (it de-duplicates the common lib and lib64 directories). Our solution was to delete the 'lib64' symlink after the venv is created.