Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

serverless deployment error - Code storage limit exceeded

Deployment of my serverless project has started returning the following error

An error occurred while provisioning your stack... [lambda name][GUID] - Code storage limit exceeded..

I've tried deleting zip packages thinking there a limit to how many upload packages can be stored in the S3 bucket, but no luck.

As mentioned by Trent below, I've looked at the deployment limits, but with a compressed packaged of 2.1MB (8MB uncompressed) I can't see what limits I would be exceeding.

Any suggestions on what might be causing this.

(My) Solution:

I was hoping to get a better understanding of the underlying problem, and was hoping to do this as a last resort. But it appears by deleting the stack from cloudformation and redeploying the serverless project the problem has fixed itself.

like image 893
Adam Avatar asked Sep 04 '17 20:09

Adam


1 Answers

For anybody else finding this through google, hope this helps.

What is causing it?

AWS has a limit of 75GB on the size of all the deployment packages that can be uploaded per region. This includes all of your Lambda functions and all their historical versions combined in a given region.

The error could happen if you have a large number of Lambda functions that have been deployed many times. Each deployment creates a version and this can add up over time.

Solution 1

If you do not need to version your Lambda functions, you can turn off Lambda versioning by setting it in your serverless.yml.

provider:
  name: aws
  versionFunctions: false

Solution 2

Alternatively, you can manually remove older Lambda versions. You can use the serverless-prune-plugin to automate the process for you. The plugin can be used to do a one-time clean up, or can be configured in your serverless.yml to auto prune older Lambda versions after each deployment.

Here's more details about this error - https://seed.run/docs/serverless-errors/code-storage-limit-exceeded

like image 168
Frank Avatar answered Sep 18 '22 15:09

Frank