lambda: Node 22
📊Tracking: [Lambda/Custom Resources] upgrade to Node 22
Lambda Node 22 coldstart latency regression - defer loading of node:http
Node 20 / 22 schedule
How Can I Find All Lambda Functions Using Node.js 20 Across Multiple AWS Accounts?
Does the Node.js 20 EOL Affect Lambda Layers Too?
Can I Skip Node.js 22 and Go Straight to Node.js 24?
Videos
The AWS CLI doesn't provide a means for converting a lambda ARN or a lambda runtime ARN into a corresponding Node.js version.
If you want this information just report it to CloudWatch via console.log(process.version), and then inspect the log for a test run.
For example:
export const handler = async (event) => {
console.log('NODE_VERSION', process.version)
const response = {
statusCode: 200,
body: process.version,
};
return response;
};
Produces logs like:
INIT_START Runtime Version: nodejs:20.v22 Runtime Version ARN: arn:aws:lambda:us-west-2::runtime:b41f958332022b46328145bcd27dce02539c950ccbf6fde05884f8106362b755
2024-05-07T18:44:28.717Z 47f2299a-daec-4586-b97f-fd7c0ebf66b4 INFO NODE_VERSION v20.12.0
The Lambda runtime version does not correlate to the Node.js minor version, so for example the runtime version "nodejs 18.v24" does not mean it should be using Node.js version 18.24.x, rather it's the 24th time aws has updated the nodejs18 runtime.
The issue is likely being caused by a dependency, normally a patch version wouldn't cause an issue like that so it might be a rare issue that's difficult to find
As a temporary solution it looks you can set the lambda runtime manually and stop it from updating it so you can have some time to find the issue then update the runtime version. There is some information in the aws documentation about this:
In the rare event that a new runtime version is incompatible with your existing function, you can roll back its runtime version to an earlier one. This keeps your application working and minimizes disruption, providing time to remedy the incompatibility before returning to the latest runtime version.
I'm assuming your lambda function is currently using the $LATEST version by default, and must be automatically updating the runtime version as well, so these instructions might be what you need
If you're using the Auto runtime version update mode, or you're using the $LATEST runtime version, you can roll back your runtime version using the Manual mode. For the function version you want to roll back, change the runtime version update mode to Manual and specify the ARN of the previous runtime version.
You can get the ARN of the working version from the labda logs you posted with the question
These are documentation pages I found this info from
- https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html
- https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html#runtime-management-controls
- https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html#runtime-management-identify
In console:
- Go to your function
- Go to the "Code" tab
- Scroll down to "Runtime settings"
- Click "Edit"
Now you can select a later Node.js version
if you want to update lambda with a specific node run time version i think this should help, this uses aws cli ( use updated version of aws cli)
aws lambda update-function-configuration \
--function-name my-function \
----runtime nodejs10.x
see API docs for more