![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
Every year, a new version of Node.js server-side JavaScript runtime engine is released, and this release of version 14 brings a number of features and enhancements that should excite developers, including built-in diagnostic reporting and the ability to store data through the life of a web request.
Although Node.js 14 won’t be prompted to Long Term Support status until Oct. 2020, this release should be considered a must-have for many, especially given version 13 reaches end of life in June 2020.
Let’s take a look at some of the more exciting features for this new release.
The Diagnostic Report has officially been added as a stable feature for Node.js 14. For those that don’t know, Diagnostic Report provides user-consumable reports that contain information for debugging and triaging issues within a production environment. Diagnostic Report is capable of identifying almost all Node.js application anomalies in production, such as:
Diagnostic Report was originally available as an npm module. In order to use the tool, users would have to install the module with the help of npm like so:
npm install node-report
Once installed, you could trigger a report, via an API call such as:
var nodereport = require('node-report');
nodereport.triggerReport();
With the release of Node.js, it is no longer necessary to install node-report, as the functionality is built into Node.js.
Now, a report can be generated from within you application in the form of:
process.report.writeReport('./filename.json');
You can also generate a report from the command line like so:
node --report-uncaught-exception --report-on-signal --report-on-fatalerror app.js
You can generate reports with other options, such as:
Another feature that should have many a developer nodding in appreciation is the addition of the experimental AsyncLocalStorage API. This high-level API will make it easier for applications to reach stability as it exposes fewer internals.
AsyncLocalStorage is used to create asynchronous state within callbacks and promise chains, and allows storing data throughout the lifetime of a web request. AsyncLocalStorage is similar to thread-local storage in other languages.
Although you might find other npm modules provide a similar functionality, using those various packages in a comprehensive way was challenging. Because of this, it was decided an API should be provided.
With the release of v14.0.0, there were some other changes developers should know about. For example:
Also note, the following have been deprecated:
With the upgrade to Node.js 14, there are new compiler and platform minimums to make note of. For example, the minimum macOS target version is now 10.13 (High Sierra). For Linux, the minimum GCC level remains at 6, but the developers of Node.js are planning to build and release binaries for platforms using GCC 8. Finally Node.js 14 will not run on Windows releases that have reached end-of-life.
Feature image by Herney Gómez from Pixabay.