AWS Lambda Layers and local dev

aws

#1

Hi all,

Just started using Serverless and loving it. I’m working on a project that uses an existing AWS Layer. My development environment is (usually) Windows which causes problems with some compiled node modules. In production, this is resolved by the Layer but in the dev environment, I need a way to use the local non-layer-ified equivalent library.

I’ve included the library under devDependencies which keeps sls deploy happy. What I really need are 2 different node_modules: One for the local equivalent of layer-ified modules, and one for all others.

Unfortunately, the dep in question has a massive amount of dependencies itself, so an exclude rule would barely make a dent.

So, to boil it down:

  1. What’s the correct way to handle code provided by external layers when testing locally?
  2. What’s the best way to separate a subset of local and production dependencies? Is devDependencies enough in this case?

Thanks!


Lambda Layers & Node & require the layer code & sls invoke local
#2

I’m not entirely sure how to handle layers locally. I’m working on some ideas tho.