[英]How to resolve ApiLambdaFunction error using serverless to deploy Angular app to AWS
I am trying to deploy my Angular app to AWS using the serverless package, following the steps in this tutorial.我正在尝试按照本教程中的步骤使用无服务器包将我的 Angular 应用程序部署到 AWS。
I've followed the steps correctly, & ran npm run build:serverless:deploy
, but rather than the app being successfully deployed I get the following error message in the console:我已经正确地遵循了这些步骤,并运行了
npm run build:serverless:deploy
,但是我没有成功部署应用程序,而是在控制台中收到以下错误消息:
An error occurred: ApiLambdaFunction - The runtime parameter of nodejs6.10 is no longer supported for creating or updating AWS Lambda functions.
发生错误:ApiLambdaFunction - 创建或更新 AWS Lambda 函数不再支持 nodejs6.10 的运行时参数。 We recommend you use the new runtime (nodejs10.x) while creating or updating functions.
我们建议您在创建或更新函数时使用新的运行时 (nodejs10.x)。 (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: dba0ade8-1f2c-4dc7-8ddc-c2966a54a67c).
(服务:AWSLambdaInternal;状态代码:400;错误代码:InvalidParameterValueException;请求 ID:dba0ade8-1f2c-4dc7-8ddc-c2966a54a67c)。
When I run node -v
in my command line, I see that it's version 10.14.1.当我在命令行中运行
node -v
时,我看到它的版本是 10.14.1。
However, I did find the following nodejs6.10
reference in serverless.yml
:然而,我发现下面的
nodejs6.10
参考serverless.yml
:
provider:
name: aws
runtime: nodejs6.10
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
Can someone please tell me why this is occurring & how to resolve it?有人可以告诉我为什么会发生这种情况以及如何解决吗?
The reason it happens is that you are trying to set the Node.js version running in your Lambda function to Node.js 6 and this is no longer supported.发生这种情况的原因是您尝试将在 Lambda 函数中运行的 Node.js 版本设置为 Node.js 6,而这不再受支持。
Change your serverless.yml
file to将您的
serverless.yml
文件更改为
provider:
name: aws
runtime: nodejs10.x
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
The error message is pretty clear though.错误信息虽然很清楚。 AWS has discontinued the support for Node.js 6 one or two months ago.
AWS 在一两个月前停止了对 Node.js 6 的支持。 Only functions that were originally created in this version will still work.
只有最初在此版本中创建的函数仍然有效。 New functions can no longer be created in Node.js 6. Honestly, there isn't a single reason somebody would want to do it anyways.
不能再在 Node.js 6 中创建新函数。老实说,无论如何,没有一个人想要这样做的原因。
https://aws.amazon.com/blogs/developer/node-js-6-is-approaching-end-of-life-upgrade-your-aws-lambda-functions-to-the-node-js-10-lts/ https://aws.amazon.com/blogs/developer/node-js-6-is-approaching-end-of-life-upgrade-your-aws-lambda-functions-to-the-node-js-10-升/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.