本文介绍了Amplify无法推送auth-nodejs8.10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AWS Amplify设置身份验证。

$ 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,但这与Amplify's documentation冲突。我不认为手动编辑文件是一种解决方案,因为我不想将自己的代码注入到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

引用:https://aws-amplify.github.io/docs/cli/lambda-node-version-update

这篇关于Amplify无法推送auth-nodejs8.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 10:57