-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambda-nodejs: Bundling fails with recent pnpm version #25612
Comments
Thank you for your report. Your proposed solution sounds like a good workaround. |
Due to your insight, I was able to figure out why I was getting a corrupted archive invalid crc error when trying to deploy with sst. Thanks! |
…n’t exist (aws#25612) Added -f flag when removing node_modules/.modules.yaml from output dir as part of ES Build bundling step to support both pnpm 8.3.1 and below behaviour where this file is always generated and 8.4.0 and above where this file is not generated if no node_modules exist. Signed-off-by: Damien Hill <damien@damienhill.com>
Fix issue with esbuild bundling step using pnpm 8.4.0 and above where `{outputDir}/node_modules/.modules.yaml` does not always exist and current `rm` command fails bundling process when file is not present. Relevant change that in [pnpm 8.4.0 release notes](https://github.com/pnpm/pnpm/releases/tag/v8.4.0): > Do not create a node_modules folder with a .modules.yaml file if there are no dependencies inside node_modules. Solved by following prior rejected pull request #25617 and suggestion in original issue #25612 of adding `-f` param to `rm` command to succeed even if file doesn't exist. Updated relevant unit test to expect this flag when using pnpm. Closes #25612. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Fix issue with esbuild bundling step using pnpm 8.4.0 and above where `{outputDir}/node_modules/.modules.yaml` does not always exist and current `rm` command fails bundling process when file is not present. Relevant change that in [pnpm 8.4.0 release notes](https://github.com/pnpm/pnpm/releases/tag/v8.4.0): > Do not create a node_modules folder with a .modules.yaml file if there are no dependencies inside node_modules. Solved by following prior rejected pull request #25617 and suggestion in original issue #25612 of adding `-f` param to `rm` command to succeed even if file doesn't exist. Updated relevant unit test to expect this flag when using pnpm. Closes #25612. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fix issue with esbuild bundling step using pnpm 8.4.0 and above where `{outputDir}/node_modules/.modules.yaml` does not always exist and current `rm` command fails bundling process when file is not present. Relevant change that in [pnpm 8.4.0 release notes](https://github.com/pnpm/pnpm/releases/tag/v8.4.0): > Do not create a node_modules folder with a .modules.yaml file if there are no dependencies inside node_modules. Solved by following prior rejected pull request aws#25617 and suggestion in original issue aws#25612 of adding `-f` param to `rm` command to succeed even if file doesn't exist. Updated relevant unit test to expect this flag when using pnpm. Closes aws#25612. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
When bundling a lambda function using
lambda_nodejs
with no dependencies and withpnpm
version8.4.0
or higher, the script fails to delete thenode_modules/.modules.yaml
file.Expected Behavior
The bundling succeeds (no need to delete this file).
Current Behavior
The bundling fails with error :
Reproduction Steps
Simple lambda construct :
/lambda/package.json
/lambda/src/index.ts
/package.json
pnpm
version :v8.4.0
-> bundling failsv8.4.0
-> bundling succeedsPossible Solution
In the
bundling.ts
source file :-f
flag to therm
commandrm
command ifpnpm -v
>=8.4.0
Additional Information/Context
The
pnpm
v8.0.4 release note specifies clearly :Since
esbuild
bundles the dependencies (unless specified otherwise throughlambda_nodejs.NodejsFunctionProps['bundling]['nodeModules']
), this will break synthesis of most lambda functions.CDK CLI Version
2.70.0 (build c13a0f1)
Framework Version
No response
Node.js Version
v16.19.1
OS
macOs 13.3.1 (22E261)
Language
Typescript
Language Version
Typescript (4.9.5)
Other information
Source file is located at
packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts
The text was updated successfully, but these errors were encountered: