简体   繁体   English

如何使用无服务器将 Angular 应用程序部署到 AWS 来解决 ApiLambdaFunction 错误

[英]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.

相关问题 如何使用适用于AWS Lambda的无服务器部署来部署环境变量 - How to deploy environment variable using serverless deploy for AWS lambda 如何解决AWS Elastic Beanstalk部署错误 - How to Resolve AWS Elastic Beanstalk Deploy Error 如何使用无服务器框架将 Streamlit(前端)Web 应用程序部署到 AWS Lambda? - How to deploy a Streamlit (frontend) webapp to AWS Lambda using Serverless Framework? 如何使用serverless.yml部署AWS elasticsearch - How to deploy AWS elasticsearch using serverless.yml 无法使用无服务器框架在AWS Lambda中部署Node.js应用程序 - Cannot deploy Node.js app inside AWS Lambda using Serverless Framework 如何为 ruby 2.7.1 解决 AWS Elastic Beanstalk 上的 Rail 6 部署错误 - How to resolve Rail 6 deploy error on AWS Elastic Beanstalk for ruby 2.7.1 使用 npx serverless 更改区域以在 AWS CloudFront 上进行部署 - Change region using npx serverless to deploy on AWS CloudFront 无服务器:无法使用部署命令在 AWS 上加载 lambda 函数 - Serverless: can't load lambda function on the AWS using deploy comand 在AWS上进行无服务器部署-踩刹车 - Serverless deploy on AWS - routes brakes 使用aws角色执行无服务器部署 - execute serverless deploy with aws role
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM