cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

nodejs lambda layers not finding module

william1_master
Newcomer

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

 

 

2 REPLIES 2

michal_nalezin
Dynatrace Advisor
Dynatrace Advisor

Hi Bill,
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?

Best
Michal Nalezinski
Technical Product Manager


william1_master
Newcomer

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.


Featured Posts