04 Sep 2019 12:03 PM - last edited on 25 Mar 2022 05:49 AM by MaciejNeumann
I have a hello Lambda using oneagent that works if I include the node_module in the zip I upload for the Lambda. I followed the instructions from the enable serverless dialog.
I'm trying to move the node_modules to a Lambda Layer with the nodejs/node_modules/@dynatrace/oneagent pathing. I know the layer can be found as I can load mysql. It seems like something is wrong with my handler reference but who knows. Has anyone tried this?
Here's the reference that worked before. node_modules/@dynatrace/oneagent.main$handler
Solved! Go to Solution.
I'm afraid that just moving the node_modules into a Lambda Layer would not work.
What would be the use case for such move?
Technical Product Manager
The main use case is we have created a lambda layer of common packages at specific versions that we want each Lambda to use. It makes debugging issues much easier and faster if you know what's going on and don't have to scan the packages for differences. The common packages layer is versioned and not modified based on the whim of every dev. We currently have multiple teams that will use our layers based on their need.
Currently, every dev will have to add the package to their lambda. They may or may not optimize for deployment or may target the wrong node version. We expect several hundred new lambdas in the next year. This also means upgrades will be painful.
Also - the general benefits of using layers. Smaller deployment package, single code base, etc.
So bottom line is code management and scaling.