DEV Community

Discussion on: Make your lambda functions lightweight

Collapse
 
rcoundon profile image
Ross Coundon

Beware of layers they can ultimately complicate your deployment, particularly if you have many lambdas dependent on a layer because any updates you make to that layer is not picked up by your lambdas unless you update each one to point to the new version and redeploy.
They also make testing your functions more difficult, harder to invoke when running locally (although this should be avoided anyway - use something like serverless stack to deploy to AWS but debug/run code locally - a game changer for us)
A good summary of pros and cons here - lumigo.io/blog/lambda-layers-when-...

Collapse
 
cemdev profile image
Cesar Muñoz • Edited

I use npm packages in the layers (if I’m facing the situation on not viewing the code on prod). The handler and the shared code will be in the lambda. Also depends on how you structure the application. I faced several ways of structure the project .
I like the article I will added it into my bookmarks
I’m only make the layer on deployment time so locally with serverless offline and other plug-in (for example serverless Dynamo) works just fine.