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 Antwort
1
Akzeptierte Antwort

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

npm install @aws-amplify/cli --upgrade
Samuel
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen