Amazon web services Amplify无法推送验证-节点JS8.10

Amazon web services Amplify无法推送验证-节点JS8.10,amazon-web-services,aws-amplify,Amazon Web Services,Aws Amplify,我正在尝试用AWS Amplify设置auth $ npm install -g @aws-amplify/cli $ amplify --version Scanning for plugins... Plugin scan successful 4.13.2 身份验证是通过运行 amplify init amplify add auth amplify push 但是,最后一个命令失败 Resource Name: UserPoolClientLambda (AWS::Lambda::F

我正在尝试用AWS Amplify设置auth

$ npm install -g @aws-amplify/cli
$ amplify --version
Scanning for plugins...
Plugin scan successful
4.13.2
身份验证是通过运行

amplify init
amplify add auth
amplify push
但是,最后一个命令失败

Resource Name: UserPoolClientLambda (AWS::Lambda::Function)
Event Type: create
Reason: The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: f6d965b6-e4a6-4a0e-a380-fc07ac950266)
通过检查创建的文件,我发现它实际上使用了nodejs8.10,但是它与nodejs8.10冲突。我不认为手动编辑文件是一种解决方案,因为我不想将自己的代码注入到Amplify自动执行的操作中,并可能在某个时候被覆盖


这里有什么遗漏或做错的地方吗?

您的Amplify CLI需要是v4.10.0或更高版本。重新运行安装以更新:

npm install -g @aws-amplify/cli
下次在代码库中运行
amplify
时,它将建议更新节点运行时版本:

$ amplify --version
Scanning for plugins...
Plugin scan successful

Amplify CLI uses Lambda backed custom resources with CloudFormation to manage part of your backend resources.
In response to the Lambda Runtime support deprecation schedule
https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html
Nodejs runtime need to be updated from nodejs8.10  to nodejs10.x in the following template files:

[...]

Please test the changes in a test environment before pushing these changes to production. There might be a need to update your Lambda function source code due to the NodeJS runtime update. Please take a look at https://aws-amplify.github.io/docs/cli/lambda-node-version-update for more information

? Confirm to update the NodeJS runtime version to 10.x Yes

NodeJS runtime version updated successfully to 10.x in all the CloudFormation templates.
Make sure the template changes are pushed to the cloud by "amplify push"
4.13.4
参考:

根据AWS Lambda运行时支持政策,AWS Lambda于2020年1月6日弃用Node.js Runtime Node.js 8.10

Amplify CLI代码库已更新以反映此更改。Amplify CLI将为您创建的Lambda函数中的Node.js 8.10替换为Node.js 10。如果您使用Amplify CLI版本4.10.0及更高版本创建新的aws资源,这与您无关


根本原因:

1) npm install -g @aws-amplify/cli
2) After install click "Y" on request to update template to Node 10
3) amplify push
  • 旧的amplify版本(已尝试部署node 8 lambda模板的4.5版本)
解决方案:

1) npm install -g @aws-amplify/cli
2) After install click "Y" on request to update template to Node 10
3) amplify push

嗨,我刚修好,我相信!您需要做的是转到后端/Auth/目录并找到*.yaml文件

从那里搜索AWS::Lambda::Function服务,并将运行时环境更改为nodejs12.x

不确定为什么默认值为节点8。我跑了很多圈想弄明白这一点