future-diamond-31373
07/30/2021, 7:11 PMlambda.CallbackFunction
magic functions. My issue is that every lambda ends up including the entire project’s node_modules
directory. I traced the behavior to codePaths.ts and found that read-package-tree searches for the package.json
in the project root (where the yaml files live). It seems that the api gives us the option to define the packages we want excluded via CodePathOptions
, but the default behavior is to include every package.
Is there an elegant way to only include specified package on a per lambda basis, or perhaps to tell the callback function which package.json
to use without creating multiple pulumi projects? I know one option is to use manual function resources but I like the closure serialization and dev friendliness of magic functions. I dabbled with the idea adding a package.json
directory path as a parameter into the api so that readPackageTree
could use a dynamic path rather than hardcoding it to the root
Just wanted to gauge if the community has encountered similar problems and / or how other people handle lambda packaging. If this is an issue that more teams run into, I’d be happy to put up a PR.