node.jsamazon-web-servicesaws-lambdaruntimeversion

Finding the "true" code version of AWS Lambda runtime


The Issue

We ran into a situation where an AWS lambda runtime version update appears to be causing issues with our code.

This works (nodejs 18.v24; also .v26 works): enter image description here

This does not work (nodejs 18.v28): enter image description here

However, those version numbers do not correspond to actual Node versions that I can find. On the Node site, the latest version of 18 is 18.20.2 (as of this writing).

enter image description here

The Question

How do I find the actual Node version behind the AWS version number so I can compare differences between v.26 and v.28 to try to determine what update might be causing issues with our code?


Solution

  • 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