Working with the new Lambda Layers. I have a private node module that I cannot upload to npm public and our company’s private repo is locked down, so I figured I could use a lambda layer.
I created my module and it works locally. I used “npm link” to sym link it locally but want to require it for only a few of our lambda functions.
In serverless.yml:
layers:
myapp:
path: layer
description: layer dependencies
functions:
postSource:
handler: postSource.handler
name: postSource_${self:provider.stage}
layers:
- {Ref: MyappLambdaLayer)
my directory structure is:
/
serverless.yml
postSource.js
layer/nodejs/node8/node_modules/myapp/package.json & index.js
when I deploy, everything seems to work fine, no errors, but when I go to the AWS console, I see “layers (0)” and of course, testing the lambda in console, it wont find the module I created “Cannot find module ‘myapp’”
I am new to the Serverless Framework, so I am sure i missed an obvious step.
Thanks in advance