I’m having trouble producing individual lambda functions from a set of modules under a single serverless.yml. I feel like I’ve tried every possible combination of include/exclude and still end up with zip files containing the node_modules of the sibling functions in each of the final packaged zips.
My structure looks like this:
- lambdas - serverless.yml - function1 - node_modules - index.js - package.json - function2 - node_modules - index.js - package.json
My serverless.yml (well one of the many, many combinations I’ve tried) is:
functions: function1: handler: function1/index.handler events: - http: path: fun1/ method: post package: individually: true exclude: - "./**" include: - ./function1/** function2: handler: function2/index.handler events: - http: path: fun2/ method: post package: individually: true exclude: - "./**" include: - ./function2/**
I was hoping for one zip file for each function that contained only that function’s dependencies. But what I am getting is each zip file looks like this:
function1 - function1 - index.js - package.json - node_modules - function2 - node_modules
I’ve tried using the exclude statement on the global package setting, tried putting all the functions in a src folder, and various combination of globs for the excludes. Am I doing something obviously wrong, or is this not a supported use pattern?