We just had to put out a patch for our folks on AWS FreePBX because it appears that, since approximately 2021-05-26, something changed and now NPM throws a “URL is not defined” error when PM2 and UCP (and likely others) try to build.
URL is a global introduced in NodeJS 10.x that doesn’t exist in 8.x. So, it appears NPM is finally breaking with NodeJS 8.x (which they did warn us was coming). We needed to move to NodeJS 10.x to get PM2 and UCP reinstalled.
Folks may have noticed UCP become unavailable and/or the System Status section on the Dashboard disappear after upgrades they may have performed over the weekend, given the reports we’ve received.
The script we put out upgrades to NodeJS 10.x direct from nodesource. It’s mostly a quick alteration of the official nodesource script for RPM-based systems, modified to see ‘sangoma’ as a supported distro, drop the depreciation warnings about NodeJS 10.x, and perform a proper in-place upgrade without breaking the existing RPM dependency tree (freepbx, sangoma-pbx pkgs). Testing against latest main repo modules as of this post passed and our test systems all seem stable on 10.x.
This should be fully FreePBX-flavor agnostic for any RPM-based distro, cloud or local, should anyone else be running into this issue and are scrambling for a fix:
(AWS FreePBX Customers with broken systems can simply run
smartupgrade upgrade-nodejs to install 10.x. We’ve already alerted them but they sometimes come here, as well.)
PM2, UCP, or any other modules that got broken likely need
downloadinstall‘ed after moving to 10.x in order to rebuild, if they got broken by 8.x during the previous attempt to upgrade. I don’t think the failure in NPM is precluding the modules’ version flag from being updated in the DB. So a simple
upgradeall reports no upgrades but the modules remain in a broken state until forced to rebuild with a reinstall.
Haven’t had any time to spin up an official distro system to see if this is the case there, but I suspect this is NPM’s last gasp with NodeJS 8.x, whether we (TWMnet, Sangoma, RedHat) are ready or not.
Are there any known issues with NodeJS 10.x and FreePBX modules that still need ironed out; that we should be on the lookout for? I saw a few of the typical warnings on module updates about a few various NPM packages being depreciated within the individual modules, but nothing breaking thus far.