Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An error occurred (RequestEntityTooLargeException) when calling the UpdateFunctionCode operation

Tags:

aws-lambda

When I deploy lambda function using the command below, the error is occured.

aws lambda update-function-code --function-name example --zip-file fileb://lambda.zip
An error occurred (RequestEntityTooLargeException) when calling the UpdateFunctionCode operation

As far as I looked through, my zip size can not be reduced any more. How can I avoid this or are there any alternative way to deploy?

like image 541
yn1043 Avatar asked Sep 23 '26 19:09

yn1043


2 Answers

Although layers are a good way to solve this, you can also upload your .zip file to S3 and update your function to the extent of:

aws lambda update-function-code --function-name LAMBDA_NAME --region REGION_NAME --s3-bucket BUCKET_NAME --s3-key S3_KEY/TO/PACKAGE.zip
like image 117
ivica Avatar answered Sep 25 '26 20:09

ivica


There is a limit to direct upload of 50MB: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

You can use a LambdaLayer as a workaround to this problem:

  • https://lumigo.io/blog/lambda-layers-when-to-use-it/
  • https://aws.amazon.com/blogs/compute/using-lambda-layers-to-simplify-your-development-process/

With layers, you got 250MB Limit

A disclosure - I'm a developer in Lumigo, we have just a blogpost on this thread, shared also an official AWS post.

like image 38
ServerlessChamp Avatar answered Sep 25 '26 21:09

ServerlessChamp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!