How to get Serverless project file dependencies to work with Lambda
In AWS Lambdas, if you require a file like
../../../../lib you're out of luck. Serverless will not resolve that file correctly when creating the zip. This happens when the
serverless.yml files are buried deep in your project directories. Node modules dependencies are handled correctly. (thats good).
models, etc. correctly, I'm trying an approach using environment variables.
Here's our API directory structure. All of our shared files, like
models are at the root level. Many lambdas may need access to the same mode or library.
We have hundreds of lambdas and have run into issues when having so many in one
serverless.yml file. This approach allows to have one project, The API, with many
serverless.yml dividing it all up into manageable services that can share code.