I am using Lambda with nodeJs. The problem is that due to the node_modules
dependencies I quite soon:
- Reach the maximum size of a lambda (3MB) that can still be edited in the online code editor (on the lambda page of the AWS Console).
- Reach the maximum size that I can deploy with the
sam deploy
command.
I also noticed on the AWS console the entire code base (with all of the functions and layers) is uploaded for each of the lambda functions, which is probably adding to the uploaded size counted towards the limits.
How can I avoid these limits? The library dependencies will likely to just grow over time. I tried to put all the npm dependencies in a separate layer, but that didn't help, as I still need to upload the functions and layers together from the command line, and they are both counted together towards both limits I think.