Skip to content

Commit beff7f4

Browse files
bnusunnyseshubaws
andauthored
feat: add nodejs24.x runtime support (#8431)
Co-authored-by: seshubaws <116689586+seshubaws@users.noreply.github.com>
1 parent fbd8d3d commit beff7f4

12 files changed

Lines changed: 93 additions & 11 deletions

File tree

samcli/commands/build/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
Supported Runtimes
5858
------------------
5959
1. Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 using PIP\n
60-
2. Nodejs 22.x, Nodejs 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
60+
2. Nodejs 24.x, 22.x, 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
6161
3. Ruby 3.2, 3.3, 3.4 using Bundler\n
6262
4. Java 8, Java 11, Java 17, Java 21, Java 25 using Gradle and Maven\n
6363
5. Dotnet8, Dotnet6 using Dotnet CLI\n

samcli/lib/build/workflow_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ def get_layer_subfolder(build_workflow: str) -> str:
9292
"python3.12": "python",
9393
"python3.13": "python",
9494
"python3.14": "python",
95-
"nodejs4.3": "nodejs",
96-
"nodejs6.10": "nodejs",
9795
"nodejs8.10": "nodejs",
9896
"nodejs16.x": "nodejs",
9997
"nodejs18.x": "nodejs",
10098
"nodejs20.x": "nodejs",
10199
"nodejs22.x": "nodejs",
100+
"nodejs24.x": "nodejs",
102101
"ruby3.2": "ruby/lib",
103102
"ruby3.3": "ruby/lib",
104103
"ruby3.4": "ruby/lib",
@@ -169,6 +168,7 @@ def get_workflow_config(
169168
"nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
170169
"nodejs20.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
171170
"nodejs22.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
171+
"nodejs24.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
172172
"ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
173173
"ruby3.3": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
174174
"ruby3.4": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),

samcli/lib/utils/architecture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"nodejs18.x": [ARM64, X86_64],
2020
"nodejs20.x": [ARM64, X86_64],
2121
"nodejs22.x": [ARM64, X86_64],
22+
"nodejs24.x": [ARM64, X86_64],
2223
"python3.8": [ARM64, X86_64],
2324
"python3.9": [ARM64, X86_64],
2425
"python3.10": [ARM64, X86_64],

samcli/local/common/runtime_template.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
],
4141
"nodejs": [
4242
{
43-
"runtimes": ["nodejs22.x", "nodejs20.x", "nodejs18.x", "nodejs16.x"],
43+
"runtimes": ["nodejs24.x", "nodejs22.x", "nodejs20.x", "nodejs18.x", "nodejs16.x"],
4444
"dependency_manager": "npm",
4545
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"),
4646
"build": True,
@@ -118,6 +118,7 @@ def get_local_lambda_images_location(mapping, runtime):
118118
"java11",
119119
"java8.al2",
120120
# nodejs runtimes in descending order
121+
"nodejs24.x",
121122
"nodejs22.x",
122123
"nodejs20.x",
123124
"nodejs18.x",
@@ -152,6 +153,7 @@ def get_local_lambda_images_location(mapping, runtime):
152153
"java17": "amazon/java17-base",
153154
"java11": "amazon/java11-base",
154155
"java8.al2": "amazon/java8.al2-base",
156+
"nodejs24.x": "amazon/nodejs24.x-base",
155157
"nodejs22.x": "amazon/nodejs22.x-base",
156158
"nodejs20.x": "amazon/nodejs20.x-base",
157159
"nodejs18.x": "amazon/nodejs18.x-base",

samcli/local/docker/lambda_debug_settings.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,20 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
177177
**_container_env_vars,
178178
},
179179
),
180+
Runtime.nodejs24x.value: lambda: DebugSettings(
181+
entry
182+
+ ["/var/lang/bin/node"]
183+
+ debug_args_list
184+
+ ["--no-lazy", "--expose-gc"]
185+
+ ["/var/runtime/index.mjs"],
186+
container_env_vars={
187+
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node24/node_modules:/var/runtime/node_modules:"
188+
"/var/runtime:/var/task",
189+
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
190+
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs24.x",
191+
**_container_env_vars,
192+
},
193+
),
180194
Runtime.python38.value: lambda: DebugSettings(
181195
entry + ["/var/lang/bin/python3.8"] + debug_args_list + ["/var/runtime/bootstrap.py"],
182196
container_env_vars=_container_env_vars,

samcli/local/docker/lambda_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Runtime(Enum):
4040
nodejs18x = "nodejs18.x"
4141
nodejs20x = "nodejs20.x"
4242
nodejs22x = "nodejs22.x"
43+
nodejs24x = "nodejs24.x"
4344
python38 = "python3.8"
4445
python39 = "python3.9"
4546
python310 = "python3.10"

schema/samcli.json

Lines changed: 8 additions & 5 deletions
Large diffs are not rendered by default.

tests/integration/buildcmd/test_build_cmd_arm64.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest_arm64(BuildIntegE
111111
"main.lambdaHandler",
112112
False,
113113
),
114+
(
115+
"nodejs24.x",
116+
"Esbuild/Node_without_manifest",
117+
{"main.js", "main.js.map"},
118+
"main.lambdaHandler",
119+
False,
120+
),
114121
(
115122
"nodejs20.x",
116123
"Esbuild/TypeScript_without_manifest",
@@ -125,6 +132,13 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest_arm64(BuildIntegE
125132
"app.lambdaHandler",
126133
False,
127134
),
135+
(
136+
"nodejs24.x",
137+
"Esbuild/TypeScript_without_manifest",
138+
{"app.js", "app.js.map"},
139+
"app.lambdaHandler",
140+
False,
141+
),
128142
],
129143
name_func=show_container_in_test_name,
130144
)
@@ -140,6 +154,7 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture_arm64(BuildInte
140154
[
141155
("nodejs20.x", False),
142156
("nodejs22.x", False),
157+
("nodejs24.x", False),
143158
],
144159
name_func=show_container_in_test_name,
145160
)
@@ -150,6 +165,7 @@ def test_building_default_package_json(self, runtime, use_container):
150165
[
151166
("nodejs20.x", "use_container"),
152167
("nodejs22.x", "use_container"),
168+
("nodejs24.x", "use_container"),
153169
],
154170
name_func=show_container_in_test_name,
155171
)

tests/integration/buildcmd/test_build_cmd_node.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class TestBuildCommand_NodeFunctions_With_External_Manifest(BuildIntegNodeBase):
3333
[
3434
("nodejs20.x",),
3535
("nodejs22.x",),
36+
("nodejs24.x",),
3637
],
3738
name_func=show_container_in_test_name,
3839
)
@@ -48,6 +49,10 @@ class TestBuildCommand_EsbuildFunctions(BuildIntegEsbuildBase):
4849
[
4950
("nodejs20.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False, "x86_64"),
5051
("nodejs20.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False, "x86_64"),
52+
("nodejs22.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False, "x86_64"),
53+
("nodejs22.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False, "x86_64"),
54+
("nodejs24.x", "Esbuild/Node", {"main.js", "main.js.map"}, "main.lambdaHandler", False, "x86_64"),
55+
("nodejs24.x", "Esbuild/TypeScript", {"app.js", "app.js.map"}, "app.lambdaHandler", False, "x86_64"),
5156
],
5257
name_func=show_container_in_test_name,
5358
)
@@ -81,6 +86,38 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest(BuildIntegEsbuild
8186
False,
8287
"x86_64",
8388
),
89+
(
90+
"nodejs22.x",
91+
"Esbuild/Node_without_manifest",
92+
{"main.js", "main.js.map"},
93+
"main.lambdaHandler",
94+
False,
95+
"x86_64",
96+
),
97+
(
98+
"nodejs22.x",
99+
"Esbuild/TypeScript_without_manifest",
100+
{"app.js", "app.js.map"},
101+
"app.lambdaHandler",
102+
False,
103+
"x86_64",
104+
),
105+
(
106+
"nodejs24.x",
107+
"Esbuild/Node_without_manifest",
108+
{"main.js", "main.js.map"},
109+
"main.lambdaHandler",
110+
False,
111+
"x86_64",
112+
),
113+
(
114+
"nodejs24.x",
115+
"Esbuild/TypeScript_without_manifest",
116+
{"app.js", "app.js.map"},
117+
"app.lambdaHandler",
118+
False,
119+
"x86_64",
120+
),
84121
],
85122
name_func=show_container_in_test_name,
86123
)
@@ -107,6 +144,10 @@ class TestBuildCommand_EsbuildFunctionProperties(BuildIntegEsbuildBase):
107144
[
108145
("nodejs20.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
109146
("nodejs20.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
147+
("nodejs22.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
148+
("nodejs22.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
149+
("nodejs24.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
150+
("nodejs24.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
110151
],
111152
name_func=show_container_in_test_name,
112153
)
@@ -127,9 +168,11 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture(BuildIntegNodeB
127168
@parameterized.expand(
128169
[
129170
("nodejs20.x", False, "x86_64"),
130-
("nodejs22.x", False, "x86_64"),
131171
("nodejs20.x", "use_container", "x86_64"),
172+
("nodejs22.x", False, "x86_64"),
132173
("nodejs22.x", "use_container", "x86_64"),
174+
("nodejs24.x", False, "x86_64"),
175+
("nodejs24.x", "use_container", "x86_64"),
133176
],
134177
name_func=show_container_in_test_name,
135178
)

tests/unit/lib/build_module/test_workflow_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_must_work_for_python(self, runtime):
3838
self.assertIn(Event("BuildWorkflowUsed", "python-pip"), EventTracker.get_tracked_events())
3939
self.assertFalse(result.must_mount_with_write_in_container)
4040

41-
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",)])
41+
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",), ("nodejs22.x",), ("nodejs24.x",)])
4242
def test_must_work_for_nodejs(self, runtime):
4343
result = get_workflow_config(runtime, self.code_dir, self.project_dir)
4444
self.assertEqual(result.language, "nodejs")

0 commit comments

Comments
 (0)