Using Node.js for serverless applications
Node.js is an open-source JavaScript runtime environment that can run JavaScript code outside of a browser, as a server-side programming language.
Node.js can be used to create serverless applications and websites - performing server-side scripting functions and producing dynamic web content, and we use it extensively in our serverless applications and microservices built using Lambda functions in Amazon Web Services (AWS).
As part of the regular Node.js release cycle, version 8.x will become end-of-life on December 31st 2019 - and this version of Node.js will no longer receive updates or security patches.
The latest Node.js 8.x release made on 9th October 2019 contained a large number of functional updates, and the previous release was a security release containing 8 CVE patches. Node 8.x is still reliant on regular updates to maintain its security, however from December 31st 2019 it will no longer receive any updates at all.
What is AWS's Node.js 8 deprecation process?
For Node.js 8.x used in AWS Lambda, there will be 2 stages to the runtime deprecation process:
- From 6th January, 2020, customers will no longer be able to create functions using Node.js 8.10
- From 3rd February, 2020, customers will no longer be able to update functions using Node.js 8.10
After February 30th, function creation and updates will be permanently disabled, although existing Node 8.x functions will still be available to process invocation events.
Updating AWS Lambda functions to upgrade from Node.js 8.x
At time of writing, AWS Lambda does not currently support the most recent release of Node.js, version 12.x, so we'll be looking to update our Lambda functions from Node.js 8.x to Node.js 10.x.
One of the great things about AWS Lambda is that you just choose the runtime and major version - they take care of the minor and patch versions and all necessary updates.
However, when moving from one major version to another there are a number of considerations to make. Before updating our production Lambdas we'll be following a process:
- Provisioning the Lambda code either locally or in a safe development environment
- Running them against the lastest version of Node.js 10.x
- Updating dependencies to ensure compatibility
- Running tests and confirming expected behaviour
- Re-writing Lambda code and/or replacing incompatible dependencies
- Updating our Lambda deploy scripts to ensure the new 10.x runtime is specified
- Deploying the changes into our production environments
We've already begun this process for our own Lambda functions, and we'll be assisting our clients over the next few months to ensure all the updates are made in good time.