Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
ruby-version: "3.2"
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/build/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
Supported Runtimes
------------------
1. Python 3.7, 3.8, 3.9, 3.10, 3.11 using PIP\n
2. Nodejs 18.x, 16.x, 14.x, 12.x using NPM\n
2. Nodejs 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
3. Ruby 2.7, 3.2 using Bundler\n
4. Java 8, Java 11, Java 17 using Gradle and Maven\n
5. Dotnet6 using Dotnet CLI (without --use-container)\n
Expand Down
2 changes: 2 additions & 0 deletions samcli/lib/build/workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def get_layer_subfolder(build_workflow: str) -> str:
"nodejs14.x": "nodejs",
"nodejs16.x": "nodejs",
"nodejs18.x": "nodejs",
"nodejs20.x": "nodejs",
"ruby2.7": "ruby/lib",
"ruby3.2": "ruby/lib",
"java8": "java",
Expand Down Expand Up @@ -161,6 +162,7 @@ def get_workflow_config(
"nodejs14.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs16.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"nodejs20.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG),
"ruby2.7": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
"dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
Expand Down
1 change: 1 addition & 0 deletions samcli/lib/utils/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"nodejs14.x": [ARM64, X86_64],
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
"python3.7": [X86_64],
"python3.8": [ARM64, X86_64],
"python3.9": [ARM64, X86_64],
Expand Down
2 changes: 1 addition & 1 deletion samcli/lib/utils/preview_runtimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"""
from typing import Set

PREVIEW_RUNTIMES: Set[str] = set()
PREVIEW_RUNTIMES: Set[str] = {"nodejs20.x"}
4 changes: 3 additions & 1 deletion samcli/local/common/runtime_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"nodejs": [
{
"runtimes": ["nodejs18.x", "nodejs16.x", "nodejs14.x", "nodejs12.x"],
"runtimes": ["nodejs20.x", "nodejs18.x", "nodejs16.x", "nodejs14.x", "nodejs12.x"],
"dependency_manager": "npm",
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-nodejs"),
"build": True,
Expand Down Expand Up @@ -107,6 +107,7 @@ def get_local_lambda_images_location(mapping, runtime):
"java8.al2",
"java8",
# nodejs runtimes in descending order
"nodejs20.x",
"nodejs18.x",
"nodejs16.x",
"nodejs14.x",
Expand Down Expand Up @@ -136,6 +137,7 @@ def get_local_lambda_images_location(mapping, runtime):
"java11": "amazon/java11-base",
"java8.al2": "amazon/java8.al2-base",
"java8": "amazon/java8-base",
"nodejs20.x": "amazon/nodejs20.x-base",
"nodejs18.x": "amazon/nodejs18.x-base",
"nodejs16.x": "amazon/nodejs16.x-base",
"nodejs14.x": "amazon/nodejs14.x-base",
Expand Down
14 changes: 14 additions & 0 deletions samcli/local/docker/lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
**_container_env_vars,
},
),
Runtime.nodejs20x.value: lambda: DebugSettings(
entry
+ ["/var/lang/bin/node"]
+ debug_args_list
+ ["--no-lazy", "--expose-gc"]
+ ["/var/runtime/index.mjs"],
container_env_vars={
"NODE_PATH": "/opt/nodejs/node_modules:/opt/nodejs/node20/node_modules:/var/runtime/node_modules:"
"/var/runtime:/var/task",
"NODE_OPTIONS": f"--inspect-brk=0.0.0.0:{str(debug_port)} --max-http-header-size 81920",
"AWS_EXECUTION_ENV": "AWS_Lambda_nodejs20.x",
**_container_env_vars,
},
),
Runtime.python37.value: lambda: DebugSettings(
entry + ["/var/lang/bin/python3.7"] + debug_args_list + ["/var/runtime/bootstrap"],
container_env_vars=_container_env_vars,
Expand Down
1 change: 1 addition & 0 deletions samcli/local/docker/lambda_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Runtime(Enum):
nodejs14x = "nodejs14.x"
nodejs16x = "nodejs16.x"
nodejs18x = "nodejs18.x"
nodejs20x = "nodejs20.x"
python37 = "python3.7"
python38 = "python3.8"
python39 = "python3.9"
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,12 @@ class TestBuildCommand_NodeFunctions(BuildIntegNodeBase):
("nodejs14.x", False),
("nodejs16.x", False),
("nodejs18.x", False),
("nodejs20.x", False),
("nodejs12.x", "use_container"),
("nodejs14.x", "use_container"),
("nodejs16.x", "use_container"),
("nodejs18.x", "use_container"),
("nodejs20.x", "use_container"),
]
)
def test_building_default_package_json(self, runtime, use_container):
Expand All @@ -654,6 +656,7 @@ class TestBuildCommand_NodeFunctions_With_External_Manifest(BuildIntegNodeBase):
("nodejs14.x",),
("nodejs16.x",),
("nodejs18.x",),
("nodejs20.x",),
]
)
def test_building_default_package_json(self, runtime):
Expand Down Expand Up @@ -730,8 +733,10 @@ class TestBuildCommand_EsbuildFunctionProperties(BuildIntegEsbuildBase):
[
("nodejs16.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
("nodejs18.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
("nodejs20.x", "../Esbuild/TypeScript", "app.lambdaHandler", "x86_64"),
("nodejs16.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
("nodejs18.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
("nodejs20.x", "../Esbuild/TypeScript", "nested/function/app.lambdaHandler", "x86_64"),
]
)
def test_environment_generates_sourcemap(self, runtime, code_uri, handler, architecture):
Expand All @@ -753,6 +758,7 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture(BuildIntegNodeB
("nodejs14.x", False, "x86_64"),
("nodejs16.x", False, "x86_64"),
("nodejs18.x", False, "x86_64"),
("nodejs20.x", False, "x86_64"),
("nodejs12.x", "use_container", "x86_64"),
("nodejs14.x", "use_container", "x86_64"),
("nodejs16.x", "use_container", "x86_64"),
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/buildcmd/test_build_cmd_arm64.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest_arm64(BuildIntegE
"main.lambdaHandler",
False,
),
(
"nodejs20.x",
"Esbuild/Node_without_manifest",
{"main.js", "main.js.map"},
"main.lambdaHandler",
False,
),
(
"nodejs16.x",
"Esbuild/TypeScript_without_manifest",
Expand All @@ -94,6 +101,13 @@ class TestBuildCommand_EsbuildFunctions_With_External_Manifest_arm64(BuildIntegE
"app.lambdaHandler",
False,
),
(
"nodejs20.x",
"Esbuild/TypeScript_without_manifest",
{"app.js", "app.js.map"},
"app.lambdaHandler",
False,
),
]
)
def test_building_default_package_json(self, runtime, code_uri, expected_files, handler, use_container):
Expand All @@ -109,10 +123,12 @@ class TestBuildCommand_NodeFunctions_With_Specified_Architecture_arm64(BuildInte
("nodejs14.x", False),
("nodejs16.x", False),
("nodejs18.x", False),
("nodejs20.x", False),
("nodejs12.x", "use_container"),
("nodejs14.x", "use_container"),
("nodejs16.x", "use_container"),
("nodejs18.x", "use_container"),
("nodejs20.x", "use_container"),
]
)
def test_building_default_package_json(self, runtime, use_container):
Expand Down
1 change: 1 addition & 0 deletions tests/integration/validate/test_validate_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def test_lint_supported_runtimes(self):
"nodejs14.x",
"nodejs16.x",
"nodejs18.x",
"nodejs20.x",
"provided",
"provided.al2",
"provided.al2023",
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/commands/init/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_init_cli_node(self, generate_project_patch, git_repo_clone_mock):
location=self.location,
pt_explicit=self.pt_explicit,
package_type=self.package_type,
runtime="nodejs18.x",
runtime="nodejs20.x",
architecture=X86_64,
base_image=self.base_image,
dependency_manager="npm",
Expand All @@ -165,12 +165,12 @@ def test_init_cli_node(self, generate_project_patch, git_repo_clone_mock):
# need to change the location validation check
ANY,
ZIP,
"nodejs18.x",
"nodejs20.x",
"npm",
self.output_dir,
self.name,
True,
{"runtime": "nodejs18.x", "project_name": "testing project", "architectures": {"value": ["x86_64"]}},
{"runtime": "nodejs20.x", "project_name": "testing project", "architectures": {"value": ["x86_64"]}},
False,
False,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib/build_module/test_workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_must_work_for_python(self, runtime):
self.assertIn(Event("BuildWorkflowUsed", "python-pip"), EventTracker.get_tracked_events())
self.assertFalse(result.must_mount_with_write_in_container)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_must_work_for_nodejs(self, runtime):
result = get_workflow_config(runtime, self.code_dir, self.project_dir)
self.assertEqual(result.language, "nodejs")
Expand Down
1 change: 1 addition & 0 deletions tests/unit/local/docker/test_lambda_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Runtime.nodejs14x.value,
Runtime.nodejs16x.value,
Runtime.nodejs18x.value,
Runtime.nodejs20x.value,
Runtime.python37.value,
Runtime.python38.value,
Runtime.python39.value,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/local/docker/test_lambda_debug_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Runtime.nodejs14x,
Runtime.nodejs16x,
Runtime.nodejs18x,
Runtime.nodejs20x,
Runtime.python37,
Runtime.python38,
Runtime.python39,
Expand Down