如何使用无服务器解决 ApiLambdaFunction 错误以将 Angular 应用程序部署到 AWS
How to resolve ApiLambdaFunction error using serverless to deploy Angular app to AWS
我正在尝试使用 serverless package, following the steps in this 教程将我的 Angular 应用程序部署到 AWS。
我已正确执行这些步骤,& 运行 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. We recommend you use the new runtime (nodejs10.x) while
creating or updating functions. (Service: AWSLambdaInternal; Status
Code: 400; Error Code: InvalidParameterValueException; Request ID:
dba0ade8-1f2c-4dc7-8ddc-c2966a54a67c).
当我在命令行中 运行 node -v
时,我看到它的版本是 10.14.1。
不过,我确实在 serverless.yml
中找到了以下 nodejs6.10
参考资料:
provider:
name: aws
runtime: nodejs6.10
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
有人可以告诉我为什么会发生这种情况以及如何解决它吗?
发生这种情况的原因是您试图将 Lambda 函数中的 Node.js 版本 运行 设置为 Node.js 6,而这已不再受支持。
将您的 serverless.yml
文件更改为
provider:
name: aws
runtime: nodejs10.x
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
虽然错误信息很清楚。 AWS 已经在一两个月前停止了对 Node.js 6 的支持。只有最初在此版本中创建的功能仍然有效。在 Node.js6 中无法再创建新功能。老实说,无论如何,没有任何人想要这样做的原因。
我正在尝试使用 serverless package, following the steps in this 教程将我的 Angular 应用程序部署到 AWS。
我已正确执行这些步骤,& 运行 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. We recommend you use the new runtime (nodejs10.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: dba0ade8-1f2c-4dc7-8ddc-c2966a54a67c).
当我在命令行中 运行 node -v
时,我看到它的版本是 10.14.1。
不过,我确实在 serverless.yml
中找到了以下 nodejs6.10
参考资料:
provider:
name: aws
runtime: nodejs6.10
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
有人可以告诉我为什么会发生这种情况以及如何解决它吗?
发生这种情况的原因是您试图将 Lambda 函数中的 Node.js 版本 运行 设置为 Node.js 6,而这已不再受支持。
将您的 serverless.yml
文件更改为
provider:
name: aws
runtime: nodejs10.x
memorySize: 192
timeout: 10
stage: production
region: eu-central-1
虽然错误信息很清楚。 AWS 已经在一两个月前停止了对 Node.js 6 的支持。只有最初在此版本中创建的功能仍然有效。在 Node.js6 中无法再创建新功能。老实说,无论如何,没有任何人想要这样做的原因。