AWS SAM giving error Unsupported Lambda runtime nodejs18.x
Asked Answered
A

2

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

Ashmead answered 20/9, 2022 at 15:7 Comment(0)
P
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.

Phago answered 29/9, 2022 at 21:33 Comment(1)
seems like it's supported nowSymphony
C
4

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

Here is the list for all suported languages

Capstone answered 2/6, 2023 at 8:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.