Lambda Deployment package fails with size error

0

Maybe I am missing something obvious but I was wondering why the Code Pipeline is failing on the Code Deploy step even though my outputted artifacts is below the space requirement? My zipped package is 48 MB and my unzipped is 213 MB, both of which are under the 50 MB and 250 MB limits.

The error that I'm getting is:

Resource handler returned message: "Code uncompressed size is greater than max allowed size of 272629760. (Service: Lambda, Status Code: 400, Request ID: 42a0e0c4-031a-4481-9a6d-765a662123f5)" (RequestToken: 22cbb818-6658-7473-f6c7-65f1872593ca, HandlerErrorCode: InvalidRequest)```

I tried the following:
- used `npm shrinkwrap`, `npm ci`, and `npm install --production` as well as a combination of the three to get my space under the limit
- copied the package-lock.json of a previous successful pipeline and it still fails
- hardcoding the CodeUri of a previous successful pipeline and it failed

Is there something that I missed? I was thinking of doing the Lambda Layers next but im not sure what that will change since that is used for reducing the size when we are already under the limit.
1 個回答
0

Using Lambda Layers won't help in this case because all of your code (including the layers) must be under 250 MB uncompressed. The Lambda service is showing that combined size in the error message.

You might consider using a container image instead as they have larger size limits.

profile pictureAWS
專家
已回答 1 年前
AWS
專家
已審閱 1 年前
  • Ah appreciate it, I was looking into that too. Do you have an idea of why the size issue is still being triggered or what areas I should check? I did a "Get Info" on an unzipped package straight from the S3 bucket that I upload the artifact to in the pipeline and it was only 213 MB.

  • From this distance it's impossible to say why the Lambda service is giving that error. The best way to find out is to contact our support team.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南