How can i Deploy my Express app on AWS LAmbda whose dependencies(node_modules) exceeds 1GB in size

0

I am trying to deploy my Nestjs(Express) app to Aws Lambda functions , I am getting an error

Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes

I know that there is limit of 250Mb size for Lambda function . Here is my code detail .. My core code size is almost 14MB in size unzipped and it is except the dependencies (node_modules folder) , node_modules file size is 990 Mb, it may be go on increasing when we go on developing the app.

Can you suggest some workaround, or concept how i can manage the dependency outside of Lambda function and without impacting the app working.

I even tried Lambda layer , As i read, it is generally used to separate the dependencies from the main lambda function to make lambda function light , but this even doesn't seem to work for me as the 250MB size limitation is including lambda layers as well.

Please suggest me any other alternatives that I can use to implement my app to AWS Lambda.

Sagar
asked 5 months ago215 views
1 Answer
0

If you cannot slim down the size of the application to fit within the limits for a zip based deployment. You could package the application code and node_modules into a container image. AWS Lambda supports container images up to 10GB in size. Details on how to do this with Node can be found here: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-image.html

AWS
Steve
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions