chore: update nodejs to 22#270
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Node.js from version 20 to version 22 for AWS Lambda functions, along with updating the CDK to version 2.232.1 and setting the minimum Node.js version to 20.0.0.
Key changes:
- Lambda runtime updated from
NODEJS_20_XtoNODEJS_22_X - CDK updated from 2.131.0 to 2.232.1
- Minimum Node.js version updated from 18.18.0 to 20.0.0
- Removed
undicidependency as it's now included in Node 20+ types
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/common-lambda-props.ts | Updated runtime to NODEJS_22_X for Lambda functions |
| src/NextjsDistribution.ts | Updated EdgeFunction runtime to NODEJS_22_X ( |
| package.json | Updated @types/node to ^20, CDK to 2.232.1, removed undici, updated engines to node >= 20.0.0 |
| .projenrc.ts | Updated minNodeVersion to 20.0.0, cdkVersion to 2.232.1, @types/node to ^20, esbuild target to node20 |
| src/types.d.ts | Removed file (undici types no longer needed) |
| yarn.lock | Updated dependencies including CDK, @types/node, and removed undici |
| .projen/tasks.json | Updated esbuild target to node20 for bundling tasks |
| .projen/deps.json | Updated @types/node to ^20, aws-cdk-lib to ^2.232.1, removed undici |
| .github/workflows/*.yml | Updated Node.js version to >= 20.0.0 in CI workflows |
| src/generated-structs/*.ts | Updated TypeScript interfaces to match new CDK version APIs |
| API.md | Generated documentation updates reflecting CDK API changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const signFnUrlDir = path.resolve(__dirname, '..', 'assets', 'lambdas', 'sign-fn-url'); | ||
| const originRequestEdgeFn = new cloudfront.experimental.EdgeFunction(this, 'EdgeFn', { | ||
| runtime: Runtime.NODEJS_20_X, | ||
| runtime: Runtime.NODEJS_22_X, |
There was a problem hiding this comment.
Lambda@Edge (EdgeFunction) does not support Node.js 22.x runtime. As of early 2025, Lambda@Edge only supports runtimes up to Node.js 20.x. The Node.js 22.x runtime is only available for regular Lambda functions, not Lambda@Edge functions. This will cause deployment failures when trying to create the EdgeFunction.
You should keep this EdgeFunction on Runtime.NODEJS_20_X while updating regular Lambda functions to Node.js 22.x.
| runtime: Runtime.NODEJS_22_X, | |
| runtime: Runtime.NODEJS_20_X, |
| platform: 'node', | ||
| sourcemap: true, | ||
| target: 'node18', | ||
| target: 'node20', |
There was a problem hiding this comment.
[nitpick] The esbuild target is set to node20, but the Lambda runtime is being updated to NODEJS_22_X. For consistency and to potentially take advantage of Node.js 22 features, consider updating the esbuild target to node22. While Node.js 20-compiled code will run on Node.js 22, matching the target to the runtime ensures optimal compatibility and feature usage.
| target: 'node20', | |
| target: 'node22', |
|
Thanks! |
Fixes #267