FlowFuse / device-agent

An agent to run FlowFuse managed instances of Node-RED on devices
Apache License 2.0
15 stars 8 forks source link

Remove Node 14 support in Device Agent 3.x due to 'inflight' deprecation #263

Open knolleary opened 1 month ago

knolleary commented 1 month ago

As of May 23rd, the inflight module has been deprecated. This means users now see the following warning when they install the module:

npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.

The module is deep in the mqtt module dependency tree (see below), but more importantly, it is not in the functional code path of the device agent. So our end users are in no way impacted.

However, that install warning is alarming and has already triggered support questions within a day of the deprecation. Ideally we need to remove it from our dependency tree. However, that brings some complication.

The module is in the dependency tree of mqtt@4.x. It is not in the dependency tree of mqtt@5.x - however, 5.x drops support for Node 14 - something we want to try to keep for some of the device manufacturers in the ecosystem. I think it is unlikely that the mqtt project will accept a patch for the 4.x stream - they haven't done any maintenance releases on it since 5.x was released two years ago.

This was a somewhat inevitable outcome whilst trying to keep support for such an old version of node.js.

We have two options:

  1. Do nothing other than document it. No-one reads the docs, but at least there will be an answer to be found when searching.
  2. Update mqtt to 5.x and drop support for Node 14.

Moving forward, option 2 feels the only way forward. Node 14 is very old and this is only going to be the first of many such cases where fixes are not made available in older versions of our dependencies.

I propose we bump the Device Agent to 3.x. We can still support Device Agent 2.x on Node 14, but will be in maintenance mode (unless there is a specific business need to backport something).