简体   繁体   English

AWS SAM 给出错误 Unsupported Lambda runtime nodejs18.x

[英]AWS SAM giving error Unsupported Lambda runtime nodejs18.x

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我正在尝试使用 AWS sam 运行一个简单的 lambda function,版本(1.57.0)我已经安装在我的 ubuntu 系统 nodejs 版本 14.18.3 当我尝试运行该项目时,它给出了 errorUnsupported Lambda runtime nodejs18.x 下面是完整的堆栈跟踪

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.在此之前,我确实在系统中安装了节点版本 18。 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我认为这可能会导致问题,所以我卸载了该版本并安装了版本 14。我不知道为什么 sam 在节点版本 18 上运行它

I just recently looked into this as well since Node 18 is the current LTS.我最近也对此进行了调查,因为 Node 18 是当前的 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 .如果您 go 到无服务器图像存储库,您将看到 AWS SAM 目前没有节点 18 的图像。在这个Github 问题中对此有解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM