From f2470ee8320b1fcfbd6db59e373271b13d5881de Mon Sep 17 00:00:00 2001 From: Roger Zhang Date: Thu, 21 Nov 2024 20:12:29 -0800 Subject: [PATCH] nodejs22.x support for SAM and lambda --- .../src/lambda/models/samLambdaRuntime.ts | 10 ++++++---- .../lambda/models/samLambdaRuntime.test.ts | 4 ++++ packages/core/src/testInteg/sam.test.ts | 19 +++++++++++++++++++ ...-70218814-03d4-4dd8-94b6-978238ccc0c1.json | 4 ++++ packages/toolkit/README.quickstart.cloud9.md | 4 ++-- 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 packages/toolkit/.changes/next-release/Feature-70218814-03d4-4dd8-94b6-978238ccc0c1.json diff --git a/packages/core/src/lambda/models/samLambdaRuntime.ts b/packages/core/src/lambda/models/samLambdaRuntime.ts index 70d679b2c1f..58311474d41 100644 --- a/packages/core/src/lambda/models/samLambdaRuntime.ts +++ b/packages/core/src/lambda/models/samLambdaRuntime.ts @@ -30,6 +30,7 @@ export type RuntimePackageType = 'Image' | 'Zip' // TODO: Consolidate all of the runtime constructs into a single > map // We should be able to eliminate a fair amount of redundancy with that. export const nodeJsRuntimes: ImmutableSet = ImmutableSet([ + 'nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x', @@ -90,11 +91,11 @@ export const deprecatedRuntimes: ImmutableSet = ImmutableSet([ 'ruby2.7', ]) const defaultRuntimes = ImmutableMap([ - [RuntimeFamily.NodeJS, 'nodejs20.x'], - [RuntimeFamily.Python, 'python3.12'], - [RuntimeFamily.DotNet, 'dotnet6'], + [RuntimeFamily.NodeJS, 'nodejs22.x'], + [RuntimeFamily.Python, 'python3.13'], + [RuntimeFamily.DotNet, 'dotnet8'], [RuntimeFamily.Go, 'go1.x'], - [RuntimeFamily.Java, 'java17'], + [RuntimeFamily.Java, 'java21'], [RuntimeFamily.Ruby, 'ruby3.3'], ]) @@ -109,6 +110,7 @@ export const samZipLambdaRuntimes: ImmutableSet = ImmutableSet.union([ export const samArmLambdaRuntimes: ImmutableSet = ImmutableSet([ 'python3.9', 'python3.8', + 'nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x', diff --git a/packages/core/src/test/lambda/models/samLambdaRuntime.test.ts b/packages/core/src/test/lambda/models/samLambdaRuntime.test.ts index 0e6d96afffd..0bfe1acefe0 100644 --- a/packages/core/src/test/lambda/models/samLambdaRuntime.test.ts +++ b/packages/core/src/test/lambda/models/samLambdaRuntime.test.ts @@ -73,6 +73,7 @@ describe('runtimes', function () { 'nodejs16.x', 'nodejs18.x', 'nodejs20.x', + 'nodejs22.x', 'python3.10', 'python3.11', 'python3.12', @@ -86,6 +87,7 @@ describe('runtimes', function () { 'nodejs16.x', 'nodejs18.x', 'nodejs20.x', + 'nodejs22.x', 'python3.10', 'python3.11', 'python3.12', @@ -109,6 +111,7 @@ describe('runtimes', function () { 'nodejs16.x', 'nodejs18.x', 'nodejs20.x', + 'nodejs22.x', 'python3.10', 'python3.11', 'python3.12', @@ -131,6 +134,7 @@ describe('runtimes', function () { 'nodejs16.x', 'nodejs18.x', 'nodejs20.x', + 'nodejs22.x', 'python3.10', 'python3.11', 'python3.12', diff --git a/packages/core/src/testInteg/sam.test.ts b/packages/core/src/testInteg/sam.test.ts index e347479d221..8a500b405d4 100644 --- a/packages/core/src/testInteg/sam.test.ts +++ b/packages/core/src/testInteg/sam.test.ts @@ -80,6 +80,15 @@ const scenarios: TestScenario[] = [ dependencyManager: 'npm', vscodeMinimum: '1.50.0', }, + { + runtime: 'nodejs22.x', + displayName: 'nodejs22.x (ZIP)', + path: 'hello-world/app.mjs', + debugSessionType: 'pwa-node', + language: 'javascript', + dependencyManager: 'npm', + vscodeMinimum: '1.78.0', + }, { runtime: 'python3.10', displayName: 'python 3.10 (ZIP)', @@ -188,6 +197,16 @@ const scenarios: TestScenario[] = [ dependencyManager: 'npm', vscodeMinimum: '1.50.0', }, + { + runtime: 'nodejs22.x', + displayName: 'nodejs22.x (Image)', + baseImage: 'amazon/nodejs22.x-base', + path: 'hello-world/app.mjs', + debugSessionType: 'pwa-node', + language: 'javascript', + dependencyManager: 'npm', + vscodeMinimum: '1.78.0', + }, { runtime: 'python3.10', displayName: 'python 3.10 (ZIP)', diff --git a/packages/toolkit/.changes/next-release/Feature-70218814-03d4-4dd8-94b6-978238ccc0c1.json b/packages/toolkit/.changes/next-release/Feature-70218814-03d4-4dd8-94b6-978238ccc0c1.json new file mode 100644 index 00000000000..582c5a69b1d --- /dev/null +++ b/packages/toolkit/.changes/next-release/Feature-70218814-03d4-4dd8-94b6-978238ccc0c1.json @@ -0,0 +1,4 @@ +{ + "type": "Feature", + "description": "nodejs22.x support for SAM and lambda" +} diff --git a/packages/toolkit/README.quickstart.cloud9.md b/packages/toolkit/README.quickstart.cloud9.md index b67cba67c45..2fe1b3f9e36 100644 --- a/packages/toolkit/README.quickstart.cloud9.md +++ b/packages/toolkit/README.quickstart.cloud9.md @@ -88,8 +88,8 @@ When you're satisfied with performance, you can [deploy your serverless applicat The Toolkit _local SAM debugging_ feature supports these runtimes: -- JavaScript (Node.js 14.x, 16.x) -- Python (3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13) +- JavaScript (Node.js 16.x, Node.js 18.x, Node.js 20.x, Node.js 22.x,) +- Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13) 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.