The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x)

1

Hello,

I have previously been using the nodejs14.x version on my AWS react application. Today I tried to add user authentication and I got this problem when doing amplify push. Is there a straightforward way to update the version so I am compliant with nodejs20.x? I have tried updating the "runtime" property within the cloudformation template. But, when I push, it reverts to nodejs14.x. I have not been able to find a solution today but I may be overlooking the obvious. Thank you for any help.

"UserPoolClientLambda": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Code": {
          "ZipFile": "const response = require('cfn-response');\nconst aws = require('aws-sdk');\nconst identity = new aws.CognitoIdentityServiceProvider();\nexports.handler = (event, context, callback) => {\n  if (event.RequestType == 'Delete') {\n    response.send(event, context, response.SUCCESS, {});\n  }\n  if (event.RequestType == 'Update' || event.RequestType == 'Create') {\n    const params = {\n      ClientId: event.ResourceProperties.clientId,\n      UserPoolId: event.ResourceProperties.userpoolId,\n    };\n    identity\n      .describeUserPoolClient(params)\n      .promise()\n      .then(res => {\n        response.send(event, context, response.SUCCESS, { appSecret: res.UserPoolClient.ClientSecret });\n      })\n      .catch(err => {\n        response.send(event, context, response.FAILED, { err });\n      });\n  }\n};\n"
        },
        "Role": {
          "Fn::GetAtt": [
            "UserPoolClientRole",
            "Arn"
          ]
        },
        "Handler": "index.handler",
        "Runtime": "nodejs14.x",
        "Timeout": 300
      },
      "DependsOn": [
        "UserPoolClientRole"
      ]
    },
1 Answer
1
Accepted Answer

The solution was to upgrade the aws-amplify cli version.

npm install @aws-amplify/cli --upgrade
Samuel
answered 14 days ago
profile picture
EXPERT
reviewed 13 days 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