Get error with amplify

1

I use npm i -g @aws-amplify/cli@4.24

and I get error like that.

I don't know how to configure to upgrade nodejs16

Resource Name: amplify-bookstorev2-9-UpdateRolesWithIDPFuncti-CgaylzF7zTpg (AWS::Lambda::Function) Event Type: create Reason: Resource handler returned message: "The runtime parameter of nodejs10.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs16.x) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: b810b8f2-91de-404f-9f19-80a5e4db2051)" (RequestToken: ba443fee-fe0f-c7a9-f902-f050709c77f5, HandlerErrorCode: InvalidRequest)

asked 2 years ago287 views
2 Answers
0

Hi,

It seems that a Lambda function in your Amplify project has an old unsupported Node.js version configured. I assume the error message you see is triggered during amplify publish? When you created the amplify project (maybe you cloned it from a sample?) or added the lambda function to your amplify project (e.g with amplify function add), nodejs10.x was the current version. Since AWS Lambda does not support nodejs10.x anymore you will have to update the configured Node.js version in your amplify project. For a Lambda function with the name YOUR-FUNCTION-NAME, you can find the cloudformation template amplify uses at amplify/backend/function/YOUR-FUNCTION-NAME/YOUR-FUNCTION-NAME-cloudformation-template.json. Open this file and set the Runtime property in the LambdaFunction resource accordingly. For instance to the currently latest supported version nodejs16.x:

"Resources": {
  "LambdaFunction": {
      ...
      "Properties": {
        "Runtime": "nodejs16.x", // Runtime now set to 16.x
        "Layers": [],
      }
      ...
    }
  },
}

The full documentation can be found here: https://docs.amplify.aws/guides/functions/configuring-lambda/q/platform/js/

profile pictureAWS
answered 2 years ago
  • so this answer doens't solve the problem

0

Hi,

we have absolutely the same problem. We have lambda function which is generated automatically (its not our specific custom lambda) for our amplify APP with name "amplify-shorten-amplify-d-UpdateRolesWithIDPFuncti-5ECL5F9LIAZJ" but we don't have this function in our backend folder. Seems amplify automatically generates this function somehow. And we are not able to modify the NodeJS version for it as a result.

We are using aws-amplify/cli@7.6.15

I tried to update amplify to one of the latest popular versions 10.5.2. After that when I do "amplify env pull --restore" I still do not get any changes which could me allow to update NodeJS version for lambda containing substring "UpdateRolesWithIDPFuncti"

on the web I couldn't get any answers. Maybe this topic can help to understand better the problem. https://github.com/aws-amplify/amplify-cli/issues/5168

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions