lambda-cloudwatch-slack icon indicating copy to clipboard operation
lambda-cloudwatch-slack copied to clipboard

AWS no longer support Node.js 12

Open AustinAMeyer opened this issue 2 years ago • 5 comments

Hello,

This is currently broken because AWS no longer support Node.js 12. Please upgrade this to a newer version of Node.js so that this application remains functional. It really is a great tool and I would love to continue using it. I appreciate your help!

Thanks, Austin

AustinAMeyer avatar Jun 18 '23 19:06 AustinAMeyer

Here is the error message: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x) while creating or updating functions. => Retrying InvalidParameterValueException: The runtime parameter of nodejs12.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs18.x) while creating or updating functions.

AustinAMeyer avatar Jun 18 '23 20:06 AustinAMeyer

I solved it by following these steps , may be the hacky way.

  1. Install node 18 in your local
  2. remove the package-lock.json (not really required, for the sake of it i did)
  3. run npm install
  4. go to this folder cd ./node_modules/node-lambda/bin/
  5. Open the file in your favourite text editor and replace the line const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs12.x' to const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs18.x' , save the file
  6. go to root dir of this repo and run the command npm run deploy

And it worked for me

anil-venkata avatar Aug 24 '23 13:08 anil-venkata

Setting the below in .env did the trick for me.

AWS_RUNTIME=nodejs18.x

dhanvi avatar Jan 26 '24 12:01 dhanvi

I got this error after try to deploy it on node18 & node20

{
  "errorType": "TypeError",
  "errorMessage": "Cannot read properties of undefined (reading '0')",
  "trace": [
    "TypeError: Cannot read properties of undefined (reading '0')",
    "    at processEvent (/var/task/index.js:359:43)",
    "    at exports.handler (/var/task/index.js:418:5)",
    "    at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"
  ]
}

HieronyM avatar Feb 06 '24 08:02 HieronyM

All you need to do is change the version of lambda-node.

In your package.json change

"node-lambda": "0.16.0"

to

"node-lambda": "1.3.0"

bensebborn avatar Feb 09 '24 09:02 bensebborn