I originally raised a concern about use of process.cwd() in #53.
TL;DR:
It is a relatively common practice to bundle lambda code before deploying it (e.g. using esbuild or webpack). This optimization reduce the size of the artifact needing upload, and can also speed up the start time of the lambda.
This approach is actually built-in to AWS's CDK logic for deploying lambda code -- see this search.
Trying to grab the package.json using process.cwd() will always cause an import-time error when running code that was bundled.
Motivation
I originally raised a concern about use of
process.cwd()
in #53.TL;DR:
It is a relatively common practice to bundle lambda code before deploying it (e.g. using
esbuild
orwebpack
). This optimization reduce the size of the artifact needing upload, and can also speed up the start time of the lambda.Trying to grab the
package.json
usingprocess.cwd()
will always cause an import-time error when running code that was bundled.