Updating lambda stopped working with "Code storage limit exceeded"
Closed this issue · 3 comments
Context
Running latest zappa in python 3.8 context. slim_handler
set to true
.
Expected Behavior
Lambda should update with new code
Actual Behavior
Lambda fails to update due to "Code storage limit exceeded" exception.
Zappa has been running great for almost a year now. It even update successfully multiple times earlier today. Then it stopped working. I'm using the slim handler and the code is only 60mb zipped so I don't know why this just started failing. Here's the output:
Packaging project as zip.
Uploading yearend-dev-1597190872.tar.gz (56.3MiB)..
Uploading handler_yearend-dev-1597190947.zip (12.4MiB)..
Updating Lambda function code..
Oh no! An error occurred! :(
==============
==============
Need help? Found a bug? Let us know! :D
File bug reports on GitHub here: https://github.com/Miserlou/Zappa
And join our Slack channel here: https://zappateam.slack.com
Love!,
~ Team Zappa!
Traceback (most recent call last):
File "/var/lang/lib/python3.8/site-packages/zappa/cli.py", line 2778, in handle
sys.exit(cli.handle())
File "/var/lang/lib/python3.8/site-packages/zappa/cli.py", line 512, in handle
self.dispatch_command(self.command, stage)
File "/var/lang/lib/python3.8/site-packages/zappa/cli.py", line 559, in dispatch_command
self.update(self.vargs['zip'], self.vargs['no_upload'])
File "/var/lang/lib/python3.8/site-packages/zappa/cli.py", line 961, in update
self.lambda_arn = self.zappa.update_lambda_function(**kwargs)
File "/var/lang/lib/python3.8/site-packages/zappa/core.py", line 1114, in update_lambda_function
response = self.lambda_client.update_function_code(**kwargs)
File "/var/lang/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/var/lang/lib/python3.8/site-packages/botocore/client.py", line 635, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.CodeStorageExceededException: An error occurred (CodeStorageExceededException) when calling the UpdateFunctionCode operation: Code storage limit exceeded.
Turns out we hit the code storage limit for the region due to all the different versions (100% of 75.0 GB). I'm in the process of deleting old versions as part of our deploy cleanup scripts.
We just hit that today.
Turns out there is a Zappa setting to set the number of versions to keep:
https://github.com/Miserlou/Zappa/blame/master/README.md#L919
"num_retained_versions":null, // Indicates the number of old versions to retain for the lambda. If absent, keeps all the versions of the function.
there's actually a setting for it already: num_retained_versions
.
edit: whoops, didn't see your edit; was replying to the original comment 🙃