Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News AWS Lambda Now Has Support for Node.js 18 Runtime

AWS Lambda Now Has Support for Node.js 18 Runtime

Recently AWS announced that Node.js version 18 is supported in its Function as a Service (FaaS), AWS Lambda, and is in active LTS status and ready for general use.

Developers can now author AWS Lambda functions using Node.js 18 new language features, such as improved performance for class fields and private class methods, JSON import assertions, and experimental features such as the Fetch API, Test Runner module, and Web Streams API.

The global fetch API is available by default in Node.js 18 – one of the experimental features includes a fetch function, making fetch polyfills and third-party HTTP packages redundant:

// index.mjs 

export const handler = async(event) => {
    const res = await fetch('');
    if (res.ok) {
      const data = await res.json();

    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    return response;

The experimental features can be enabled/disabled via the NODE_OPTIONS environment variable.

AWS Lambda supports the current Long Term Support (LTS) version of Node.js, which means developers who want to use the new versions need to specify a runtime parameter value of nodejs18.x when creating or updating functions or using the appropriate managed runtime base image. Furthermore, the Node.js 18 runtime is supported by functions running on either Arm-based AWS Graviton2 or x86-based processors.

Earlier, the Node.js runtime available in AWS Lambda was 16 and has been in Maintenance LTS since mid-October 2022. It will reach the end of life a year from now. 


Up till Node.js 16, Lambda’s Node.js runtimes have included the AWS SDK for JavaScript version 2, which is now upgraded to AWS SDK for JavaScript version 3 with Node.js 18. Hence, developers upgrading to Node.js 18 can update their function code to use the SDK v3 – the recommended way, according to the company. Alternatively, developers can use the Node.js 18 runtime without updating their existing code by deploying the SDK v2 and their function code.

Suraj Tripathi, cloud consultant, AppDev, explains in an AWS Compute blog post:

Version 3 of the SDK for JavaScript offers many benefits over version 2. Most importantly, it is modular, so your code only loads the modules it needs. Modularity also reduces your function size if you choose to deploy the SDK with your function code rather than using the version built into the Lambda runtime.

In addition, Steve Sanders, CTO at bootstrapped donations, tweeted:

Node 18 support in AWS Lambda!

They're also including v3 of the AWS JavaScript SDK now, which is great news if you're using that - one less thing to bundle in your deployments.

When using v3 SDK, developers can, for instance, only import the modules they need, such as ListBucketsCommand, and a service client like S3Client:

import { S3Client, ListBucketsCommand } from "@aws-sdk/client-s3";

Another change in the Node.js 18 runtime is the added support for ES module resolution via the NODE_PATH environment variable. The runtime for Lambda searches the folders listed in NODE_PATH when loading ES modules, making it easier to include the AWS SDK as an ES module or load ES modules from Lambda layers.

The community and developers welcome AWS Lambda support runtime for Node.js 18. Jean Burellier, a principal software engineer at Allianz Trade, tweeted:

Congrats to the @AWS lambda team to ship #NodeJS 18 way faster then the others version. I thought it was going to be a few more months.

Similarly, a respondent on a Reddit thread wrote:

Nice! Appreciate that the rollout was faster than Node 16.

However, others expected support for newer versions of Python for Lambda too. Efi Merdler-Kravitz, an AWS Hero, tweeted:

@jbesw  when are we going to see support for python 11?
It looks like Node gets all the action

Lastly, the Node.js programming model in the AWS Lambda documentation provides more details about writing functions in Node.js 18. Furthermore, developers can migrate their existing Node.js functions to the new runtime by changing its runtime configuration to nodejs16.x after reviewing the code for compatibility issues.

About the Author

Rate this Article