Hubert
10/01/2021, 3:42 PMsst start
for development, and today tried to deploy my application with sst deploy
which seems to have hit a lambda limit.
stack failed: Resource handler returned message: "Unzipped size must be smaller than 47358303 bytes (Service: Lambda, Status Code: 400, Request ID: e9aea816-1578-4523-9a68-2f16d3bb278c, Extended Request ID: null)" (RequestToken: 687bb199-2423-bcc6-df83-ffd2c4f44dce, HandlerErrorCode: InvalidRequest)
I've got the exact same application deployed in SLS and the functions collectively do have a size larger than the limit, but when looking at them in their "stacks" or "microservices" they dont reach more than few MBs. Any suggestions on how to go about this? I've disabled bundling on few functions but I do have quite a few using Layers and the same layer may be used in multiple stacks - not sure if its an issue but I thought i will point it out.
Thanks.Frank
Hubert
10/01/2021, 4:20 PMHubert
10/01/2021, 4:20 PMFrank
Frank
fn_read_cols.lambda_handler
that’s causing the issueFrank
.build/cdk.out
and open up the template for the live-sst-dataset-stack
stack
2. look for the ReadCols5CD479F5
resource in the template
3. at the bottom of the resource json block, there’s a aws:asset:path
4. you should see a folder in .build/cdk.out
with matching name
Can you check the size of the folder?Hubert
10/04/2021, 8:20 AMHubert
10/04/2021, 11:02 PMHubert
10/05/2021, 10:00 AMnpx sst start
Despite not making any changes to the stacks.Hubert
10/05/2021, 11:58 AMboto3
and botocore
was bundling together with my Stack causing insane stack sizes - Resolved.Frank
Unzipped size must be smaller than 262144000 bytes
b/c unzipped function size is 250MB. I was going to dig deeper into this issue, glad you got it work.Frank
Hubert
10/06/2021, 9:34 AMrequirements.txt
in the folder of the stack that it bundles up with all lambda functions in that folder, but I've since removed that in favour of layers because of this sizing problem. Layers I have a docker script that builds a python
folder with all the packages I need inside. Happy to share some code and set up for that if you would like. I have a monorepo structure, so each stack has its own ./src/stack/
folder for lambda functions that way if if i need stack-wide package bundled i can easily add it, as long as it doesnt exceed the limit. Not sure if that answers the question 🙈 As for excluding boto3 it was actually in one of those requirements.txt files and I didnt realise it, so it was bundling boto3
and botocore
with the stack and causing that huge 100+ MB size. I just removed them from requirements file in that folder. For sst start
I have a separate requirements file in the root folder with all the packages and a venv that i source before sst start
. Hope that helps 🙂Frank
Hubert
10/06/2021, 6:44 PM