aws-lambda-nodejs: spaces in path-name results in error #13210
Labels
@aws-cdk/aws-lambda-nodejs
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
Spaces in paths can break cdk synth when using @aws-cdk/aws-lambda-nodejs construct together with esbuild.
The resulting error is: "error: Must use "outdir" when there are multiple input files".
Sample repo
https://github.com/Simon-SDK/cdk_bug_report
Steps
Install repo and run "cdk synth".
Description
The error happens because of these two lines:
aws-cdk/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts
Line 143 in 296a10d
aws-cdk/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts
Line 146 in 296a10d
The output of the esbuildCommand returns un-escaped paths, making esbuild believe there are multiple files, example:
npx esbuild --bundle /.../cdk/lib/lambda function/index.ts --target=node12 --platform=node --outfile=/.../cdk/cdk.out/bundling-temp-d5ad4854b4c5ea5068744c5b1b87fe2b04eec6a7aae0e3bdd2928a97638d2e5f/index.js --external:aws-sdk
If the lambda folder in the sample repo is changed to "lambda_function", "cdk synth" runs fine.
What did you expect to happen?
Cdk synth should build a index.js using esbuild without crashing.
What actually happened?
esbuild crashes because it (wrongly) expects multiple input-files.
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: