AWS no longer support Node.js 12
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
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.
I solved it by following these steps , may be the hacky way.
- Install node 18 in your local
- remove the package-lock.json (not really required, for the sake of it i did)
- run
npm install - go to this folder
cd ./node_modules/node-lambda/bin/ - Open the file in your favourite text editor and replace the line
const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs12.x'toconst AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs18.x', save the file - go to root dir of this repo and run the command
npm run deploy
And it worked for me
Setting the below in .env did the trick for me.
AWS_RUNTIME=nodejs18.x
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)"
]
}
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"