MySQL Blog Archive
For the latest blogs go to blogs.oracle.com/mysql
Deprecating End-of-life runtime engines on Connector/Node.js

Starting with the 8.0.23 release, Connector/Node.js will be deprecating support for End-of-life Node.js engine versions. Support for these versions will eventually be removed on subsequent releases which will focus on compatibility with the available LTS versions at the date of each release.

Why now?

Up until now, the minimum Node.js engine version compatible with Connector/Node.js was version 4.2.0. This is a fairly old release that has reached End-of-life status in 2018 and, of course, hasn’t been maintained since then. This is also the case for the next two major Node.js versions – v6 and v8 – and will soon (April 30, 2021) be the case for Node.js v10. So, as of today, the oldest LTS version available is effectively Node.js v12, and the project has been missing on the JavaScript language and Node.js core platform improvements of, at least, the last three stable releases.

This is reflected as well as when it comes to dependency management and maintenance. 3rd-party libraries in the form of npm packages/modules are themselves evolving and dropping support for these older Node.js engine versions, which means projects have to follow along, in order to have access to the latest bug fixes and security updates.

One product

Part of the reason for supporting older Node.js versions like 4.2.0 is because one of the goals of MySQL as a suite of different components that include, among others, MySQL Server, MySQL Shell and MySQL Connectors can be viewed as a single product that aims to provide compatibility with the same wide set of systems and platforms. Thus, in order to provide the best possible user experience, the default software choices made, by each platform in particular, when it comes to the integrated system package repository, need to be considered. The fact is that package managers of some of these old, but not End-of-life platforms are still bound to older Node.js engine versions.

However, the best user experience can also mean not lagging behind in terms of security features, bug fixes and improvements on up-to-date 3rd-party libraries, cleaner code syntax, style, architecture and less testing hassle to encourage community contributions.

Moving forward

Starting with the 8.0.23 release, Connector/Node.js is deprecating support for EOL Node.js versions and will advertise that in a couple of ways. First, the engines field in the package.json file will, from now on, point to the oldest Node.js LTS version that doesn’t risk reaching End-of-life status by the time of the next release. In this case, it will start by version v12.0.0.

{
    // ...
    "engines": {
        "node": ">=12.0.0"
    }
    // ...
}

That way, everyone who is using an older Node.js version and tries to install the package will be facing a warning message. For a user that is running Node.js v4.2.0 with npm v2.14.7:

$ npm install @mysql/xdevapi
npm WARN engine @mysql/xdevapi@8.0.23: wanted: {"node":">= 12.0.0"} (current: {"node":"4.2.0","npm":"2.14.7"})

Additionally, a npm deprecation message will be published for older releases. For instance, users trying to install version 8.0.22 or visiting the release page on the npm registry website will see the following message:

Starting in the next version, Connector/Node.js will not guarantee compatibility with End-of-life Node.js versions. If you are planning to upgrade, make sure you are using, at least, Node.js 12.0.0.

Note that, as hinted by the deprecation message wording, right now, this doesn’t mean you will not be able to use version 8.0.23 (or any future version) of Connector/Node.js with an EOL Node.js version. It just means that you should be prepared for the fact that it might be the case in a future release, due to some of the reasons that have been mentioned above, such as incompatible JavaScript syntax or use of new core platform APIs.

It’s never a bad time to upgrade

Node.js is a fast-moving platform which also creates a fast-moving culture in most of its users. Although “dropping” support for older Node.js versions can lead to some annoyances for people who are still using them, it’s also in their best interest to upgrade, in order to avoid missing out on important changes, such as security and bug fixes.

From the project point-of-view, moving forward also means access to modern language features, core platform APIs, 3rd-party libraries, which in turn might lead to increased readability, testability and maintainability and promote more confidence for developers using, reading, changing and contributing to the code.

If you want to learn more about Connector/Node.js and the X DevAPI, please check the following:

Make sure you also join our community Slack and come hang around at the #connectors channel: