aws_lambda_nodejs: bundling with pnpm and Runtime.NODEJS_20_X fails because of pnpm bug #28318
Labels
@aws-cdk/aws-lambda-nodejs
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p3
Describe the bug
In Node.js 20, pnpm has a bug around node-fetch.
pnpm/pnpm#6424
This bug leads to the failure in bundling of app using native nodeModuels (like
sharp
).Expected Behavior
Successfully synth cdk app.
Current Behavior
Failed to synth cdk app, and show error.
pnpm [ERR_INVALID_THIS]: Value of "this" must be of type URLSearchParams
Reproduction Steps
Here is the minumum repro.
https://github.com/keisukekomeda/aws-cdk-aws_lambda_nodejs-pnpm-repro
Possible Solution
I found that using pnpm 8.12.0 resolves the error.
As a workaround, I use a custom dockerImage for bundling.
I think I'd like to update the pnpm version in default docker image.
Additional Information/Context
No response
CDK CLI Version
2.114.1 (build 02bbb1d)
Framework Version
No response
Node.js Version
v20.10.0
OS
MacOS 14.1.2(23B92)
Language
TypeScript
Language Version
TypeScript (5.2.2)
Other information
No response
The text was updated successfully, but these errors were encountered: