6

I am trying to run a simple lambda function using AWS sam, version(1.57.0) I've installed in my ubuntu system nodejs version 14.18.3 When I try to run the project it gives errorUnsupported Lambda runtime nodejs18.x Below is the full stacktrace

Invoking index.handler (nodejs18.x) Traceback (most recent call last): File "samcli/__main__.py", line 12, in <module> File "click/core.py", line 829, in __call__ File "click/core.py", line 782, in main File "click/core.py", line 1259, in invoke File "click/core.py", line 1259, in invoke File "click/core.py", line 1066, in invoke File "click/core.py", line 610, in invoke File "click/decorators.py", line 73, in new_func File "click/core.py", line 610, in invoke File "samcli/lib/telemetry/metric.py", line 176, in wrapped File "samcli/lib/telemetry/metric.py", line 126, in wrapped File "samcli/lib/utils/version_checker.py", line 41, in wrapped File "samcli/cli/main.py", line 86, in wrapper File "samcli/commands/local/invoke/cli.py", line 106, in cli File "samcli/commands/local/invoke/cli.py", line 183, in do_cli File "samcli/commands/local/lib/local_lambda.py", line 144, in invoke File "samcli/lib/telemetry/metric.py", line 240, in wrapped_func File "samcli/local/lambdafn/runtime.py", line 177, in invoke File "samcli/local/lambdafn/runtime.py", line 88, in create File "samcli/local/docker/lambda_container.py", line 91, in __init__ ValueError: Unsupported Lambda runtime nodejs18.x [43955] Failed to execute script __main__ 

I did have node version 18 installed in the system prior to this. I thought that may be giving the issue so I uninstalled that version and installed version 14. I don't have any idea why sam is running it on node version 18

2 Answers 2

6

I just recently looked into this as well since Node 18 is the current LTS. If you go to the Serverless Image Repository you'll see that AWS SAM doesn't currently have an image for Node 18. There's an explanation about this in this Github issue.

Sign up to request clarification or add additional context in comments.

1 Comment

seems like it's supported now
4

You can now update your sam cli, it now supports nodejs v18

Here is the list for all suported languages

1 Comment

You should also check your version of the sam cli, and probably upgrade to the latest. For example, node22 was only supported from version 1.130.0; see github.com/aws/aws-sam-cli/releases/tag/v1.130.0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.