From 9b1d327397256aafa1af80e9d055a63b346190de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Cornut?= Date: Mon, 24 Nov 2025 14:51:56 +0100 Subject: [PATCH] feat(Runtime): Allow nodejs24 runtime --- lib/plugins/aws/custom-resources/index.js | 2 +- lib/plugins/aws/provider.js | 1 + .../aws/custom-resources/index.test.js | 24 +++++++++---------- types/index.d.ts | 1 + 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/plugins/aws/custom-resources/index.js b/lib/plugins/aws/custom-resources/index.js index f25eb3d0e..4ff18291d 100644 --- a/lib/plugins/aws/custom-resources/index.js +++ b/lib/plugins/aws/custom-resources/index.js @@ -162,7 +162,7 @@ async function addCustomResourceToService(awsProvider, resourceName, iamRoleStat }); } - let runtimeVersion = 'nodejs22.x'; + let runtimeVersion = 'nodejs24.x'; const providerRuntime = awsProvider.getRuntime(); if (providerRuntime.startsWith('nodejs')) { runtimeVersion = providerRuntime; diff --git a/lib/plugins/aws/provider.js b/lib/plugins/aws/provider.js index 3a1c57941..d1bcb89b3 100644 --- a/lib/plugins/aws/provider.js +++ b/lib/plugins/aws/provider.js @@ -638,6 +638,7 @@ class AwsProvider { 'nodejs18.x', 'nodejs20.x', 'nodejs22.x', + 'nodejs24.x', 'provided', 'provided.al2', 'provided.al2023', diff --git a/test/unit/lib/plugins/aws/custom-resources/index.test.js b/test/unit/lib/plugins/aws/custom-resources/index.test.js index 9a8ea9b36..0f73d65ee 100644 --- a/test/unit/lib/plugins/aws/custom-resources/index.test.js +++ b/test/unit/lib/plugins/aws/custom-resources/index.test.js @@ -349,7 +349,7 @@ describe('#addCustomResourceToService()', () => { }); it('should use defined runtime', async () => { - serverless.service.provider.runtime = 'nodejs22.x'; + serverless.service.provider.runtime = 'nodejs24.x'; await Promise.all([ // add the custom S3 resource addCustomResourceToService(provider, 's3', [ @@ -398,13 +398,13 @@ describe('#addCustomResourceToService()', () => { expect( Resources.CustomDashresourceDashexistingDashs3LambdaFunction.Properties.Runtime - ).to.equal('nodejs22.x'); + ).to.equal('nodejs24.x'); expect( Resources.CustomDashresourceDashexistingDashcupLambdaFunction.Properties.Runtime - ).to.equal('nodejs22.x'); + ).to.equal('nodejs24.x'); expect( Resources.CustomDashresourceDasheventDashbridgeLambdaFunction.Properties.Runtime - ).to.equal('nodejs22.x'); + ).to.equal('nodejs24.x'); }); }); @@ -428,7 +428,7 @@ describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => { expect(properties.FunctionName.endsWith('testing-custom-resource-apigw-cw-role')).to.be.true; }); - it('falls back to nodejs22 runtime for CW custom resource if provider runtime is not nodejs ', async () => { + it('falls back to nodejs24 runtime for CW custom resource if provider runtime is not nodejs ', async () => { const { cfTemplate } = await runServerless({ fixture: 'api-gateway', command: 'package', @@ -445,10 +445,10 @@ describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => { const properties = cfTemplate.Resources.CustomDashresourceDashapigwDashcwDashroleLambdaFunction.Properties; - expect(properties.Runtime).to.equal('nodejs22.x'); + expect(properties.Runtime).to.equal('nodejs24.x'); }); - it('falls back to nodejs22 runtime for Cognito UP custom resource if provider runtime is not nodejs ', async () => { + it('falls back to nodejs24 runtime for Cognito UP custom resource if provider runtime is not nodejs ', async () => { const { cfTemplate } = await runServerless({ fixture: 'cognito-user-pool', command: 'package', @@ -462,10 +462,10 @@ describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => { const properties = cfTemplate.Resources.CustomDashresourceDashexistingDashcupLambdaFunction.Properties; - expect(properties.Runtime).to.equal('nodejs22.x'); + expect(properties.Runtime).to.equal('nodejs24.x'); }); - it('falls back to nodejs22 runtime for Event Bridge [LEGACY] custom resource if provider runtime is not nodejs ', async () => { + it('falls back to nodejs24 runtime for Event Bridge [LEGACY] custom resource if provider runtime is not nodejs ', async () => { const { cfTemplate } = await runServerless({ fixture: 'event-bridge', command: 'package', @@ -483,10 +483,10 @@ describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => { const properties = cfTemplate.Resources.CustomDashresourceDasheventDashbridgeLambdaFunction.Properties; - expect(properties.Runtime).to.equal('nodejs22.x'); + expect(properties.Runtime).to.equal('nodejs24.x'); }); - it('falls back to nodejs22 runtime for S3 custom resource if provider runtime is not nodejs ', async () => { + it('falls back to nodejs24 runtime for S3 custom resource if provider runtime is not nodejs ', async () => { const { cfTemplate } = await runServerless({ fixture: 's3', command: 'package', @@ -500,7 +500,7 @@ describe('test/unit/lib/plugins/aws/customResources/index.test.js', () => { const properties = cfTemplate.Resources.CustomDashresourceDashexistingDashs3LambdaFunction.Properties; - expect(properties.Runtime).to.equal('nodejs22.x'); + expect(properties.Runtime).to.equal('nodejs24.x'); }); it('correctly takes stage from config into account when constructing apiGatewayCloudWatchRole resource', async () => { diff --git a/types/index.d.ts b/types/index.d.ts index 888c3cb83..29d5ecbf1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -64,6 +64,7 @@ export type AwsLambdaRuntime = | "nodejs18.x" | "nodejs20.x" | "nodejs22.x" + | "nodejs24.x" | "provided" | "provided.al2" | "provided.al2023"