Developers can now author AWS Lambda functions using Node.js’ new features, such as toolchain and compiler upgrades (including prebuilt binaries for Apple Silicon), stable timers promises API, and RegExp match indices, and faster calls with argument size mismatch.
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 nodejs16.x when creating or updating functions or by using the appropriate managed runtime base image. Furthermore, the Node.js 16 runtime is supported by functions running on either Arm-based AWS Graviton2 processors or x86-based processors.
The Node.js 16 version includes support for ES modules and top-level await added to the Node.js 14 runtime in January 2022, which is useful when used with Provisioned Concurrency to reduce cold start times.
Using the bundled SDK is convenient for a few use cases. For example, developers writing short functions via the Lambda console or inline functions via CloudFormation templates may find it useful to reference the bundled SDK.
Earlier, the Node.js runtime available in AWS Lambda was 14 and has been in Maintenance LTS since October 2021. It will reach the end of life in eleven months.
Nice to see Lambda finally support Node 16. However, I’m not very happy knowing my 14.x functions will eventually deprecate. I wish there was an evergreen platform that would just auto upgrade behind the scenes like web browsers do. WebAssembly for Lambda?
In addition, the company acknowledges the late release of the Node.js 16 runtime for Lambda, and a respondent on a Reddit thread stated:
Just words for now, sure. But I don’t read self-criticism in AWS announcements often (actually can’t remember any) and am therefore inclined to believe they will improve in that regard.
Lastly, the Node.js programming model in the AWS Lambda documentation provides more details about writing functions in Node.js 16. 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.