Skip to content

Commit eb5c252

Browse files
authored
feat(lambda): nodejs22.x support (#6087)
## Problem Lambda and SAM CLI v1.130.0 start to support nodejs22.x ## Solution Add support for nodejs22.x on SAM build/debug and toolkit features If the underlying SAM CLI is showing error: `nodejs22.x is not supported`, Please update your SAM CLI to 1.130.0 or above
1 parent 0e070f6 commit eb5c252

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

packages/core/src/lambda/models/samLambdaRuntime.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type RuntimePackageType = 'Image' | 'Zip'
3030
// TODO: Consolidate all of the runtime constructs into a single <Runtime, Set<Runtime>> map
3131
// We should be able to eliminate a fair amount of redundancy with that.
3232
export const nodeJsRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
33+
'nodejs22.x',
3334
'nodejs20.x',
3435
'nodejs18.x',
3536
'nodejs16.x',
@@ -90,11 +91,11 @@ export const deprecatedRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
9091
'ruby2.7',
9192
])
9293
const defaultRuntimes = ImmutableMap<RuntimeFamily, Runtime>([
93-
[RuntimeFamily.NodeJS, 'nodejs20.x'],
94-
[RuntimeFamily.Python, 'python3.12'],
95-
[RuntimeFamily.DotNet, 'dotnet6'],
94+
[RuntimeFamily.NodeJS, 'nodejs22.x'],
95+
[RuntimeFamily.Python, 'python3.13'],
96+
[RuntimeFamily.DotNet, 'dotnet8'],
9697
[RuntimeFamily.Go, 'go1.x'],
97-
[RuntimeFamily.Java, 'java17'],
98+
[RuntimeFamily.Java, 'java21'],
9899
[RuntimeFamily.Ruby, 'ruby3.3'],
99100
])
100101

@@ -109,6 +110,7 @@ export const samZipLambdaRuntimes: ImmutableSet<Runtime> = ImmutableSet.union([
109110
export const samArmLambdaRuntimes: ImmutableSet<Runtime> = ImmutableSet<Runtime>([
110111
'python3.9',
111112
'python3.8',
113+
'nodejs22.x',
112114
'nodejs20.x',
113115
'nodejs18.x',
114116
'nodejs16.x',

packages/core/src/test/lambda/models/samLambdaRuntime.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ describe('runtimes', function () {
7373
'nodejs16.x',
7474
'nodejs18.x',
7575
'nodejs20.x',
76+
'nodejs22.x',
7677
'python3.10',
7778
'python3.11',
7879
'python3.12',
@@ -86,6 +87,7 @@ describe('runtimes', function () {
8687
'nodejs16.x',
8788
'nodejs18.x',
8889
'nodejs20.x',
90+
'nodejs22.x',
8991
'python3.10',
9092
'python3.11',
9193
'python3.12',
@@ -109,6 +111,7 @@ describe('runtimes', function () {
109111
'nodejs16.x',
110112
'nodejs18.x',
111113
'nodejs20.x',
114+
'nodejs22.x',
112115
'python3.10',
113116
'python3.11',
114117
'python3.12',
@@ -131,6 +134,7 @@ describe('runtimes', function () {
131134
'nodejs16.x',
132135
'nodejs18.x',
133136
'nodejs20.x',
137+
'nodejs22.x',
134138
'python3.10',
135139
'python3.11',
136140
'python3.12',

packages/core/src/testInteg/sam.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ const scenarios: TestScenario[] = [
8080
dependencyManager: 'npm',
8181
vscodeMinimum: '1.50.0',
8282
},
83+
{
84+
runtime: 'nodejs22.x',
85+
displayName: 'nodejs22.x (ZIP)',
86+
path: 'hello-world/app.mjs',
87+
debugSessionType: 'pwa-node',
88+
language: 'javascript',
89+
dependencyManager: 'npm',
90+
vscodeMinimum: '1.78.0',
91+
},
8392
{
8493
runtime: 'python3.10',
8594
displayName: 'python 3.10 (ZIP)',
@@ -188,6 +197,16 @@ const scenarios: TestScenario[] = [
188197
dependencyManager: 'npm',
189198
vscodeMinimum: '1.50.0',
190199
},
200+
{
201+
runtime: 'nodejs22.x',
202+
displayName: 'nodejs22.x (Image)',
203+
baseImage: 'amazon/nodejs22.x-base',
204+
path: 'hello-world/app.mjs',
205+
debugSessionType: 'pwa-node',
206+
language: 'javascript',
207+
dependencyManager: 'npm',
208+
vscodeMinimum: '1.78.0',
209+
},
191210
{
192211
runtime: 'python3.10',
193212
displayName: 'python 3.10 (ZIP)',
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "nodejs22.x support for SAM and lambda"
4+
}

packages/toolkit/README.quickstart.cloud9.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ When you're satisfied with performance, you can [deploy your serverless applicat
8888

8989
The Toolkit _local SAM debugging_ feature supports these runtimes:
9090

91-
- JavaScript (Node.js 14.x, 16.x)
92-
- Python (3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
91+
- JavaScript (Node.js 16.x, Node.js 18.x, Node.js 20.x, Node.js 22.x,)
92+
- Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
9393

9494
For more information see [Working with AWS Serverless Applications](https://docs.aws.amazon.com/cloud9/latest/user-guide/serverless-apps-toolkit.html) in the user guide.
9595

0 commit comments

Comments
 (0)