Minor update breaks the installation | FWCloud Forum

Minor update breaks the installation

darkowl

New member
Hello.

Minor update breaks the installation. I installed ising install script years ago and was updating with autoupdater ever since.
Everything was working perfectly fine, but last update fails.
During login I tried to install minor updates as offered by UI.

FWCloud-Websrv 2.0.3 2.0.4
FWCloud-UI 2.2.0 2.3.0
FWCloud-API 2.2.0 2.3.0
FWCloud-Updater 2.0.2 2.0.3

After updating (which seems to be lasting forever) API service fails with error.

Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/fwcloud/api/node_modules/uuid/dist-node/index.js from /opt/fwcloud/api/dist/src/sockets/messages/socket-message.js not supported. Instead change the require of index.js in /opt/fwcloud/api/dist/src/sockets/messages/socket-message.js to a dynamic import() which is available in all CommonJS modules.

Things I tried:
- Locking down npm to 8.3.2
- Upgrading Ubuntu (latest 22.04)
- Upgrading node.js.
- Installing node.js from suppliers repo instead of ubuntu's
- Removing FWCloud and installing it again.
- Cleaning, upgrading to ubuntu (24.04), installing clean
- Installing on completely new clean ubuntu 24.04

Always the same error.
I restored VM from backup and postpone the update. I thing something is wrong with the update - it relies on old node.js import module method or something.
 

Carles Munyoz

Administrator
Staff member
Hi,
Which version of Node.js do you have?
Can you upgrade it to Node.js 20.x or 22.x?

Sorry us for the inconveniences.
Greetings.
 

darkowl

New member
Hello. Thanks for a quick reply.
I forgot to mention it.
I tried updating to v22.22. It did not help. I can try it again on 24.04 though - this combination I did not try.
Currently running on:
root@sec-fwcloud-srv:~# npm -v
9.2.0
root@sec-fwcloud-srv:~# node -v
v18.19.1
Googling suggested falling back to v8 - but it is not something I would like to do.

The thing is - installing clean Ubuntu 24.04 and following the APT install guide here:
https://fwcloud.net/en/documentation/installation/#packages
produces the same error.
curl -s https://packagecloud.io/install/repositories/SOLTECSIS/FWCloud/script.deb.sh?any=true | sudo bash
sudo apt -y install nodejs npm mariadb-server
sudo apt -y install fwcloud-api fwcloud-ui
 
Last edited:

Carles Munyoz

Administrator
Staff member
It is necessary a Node.js version of at last 20.x.
Have you tried with Node.js 20?

We are preparing a pre-update check in order to verify it before the update.
 

darkowl

New member
On the clean system this seems to work:
root@ubuntu-gui:~# sudo apt-get update
root@ubuntu-gui:~# apt-get purge -y nodejs npm
root@ubuntu-gui:~# apt autoremove
root@ubuntu-gui:~# apt-get install -y ca-certificates curl
root@ubuntu-gui:~# curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
root@ubuntu-gui:~# sudo apt-get install -y nodejs
root@ubuntu-gui:~# node -v
v22.22.0
root@ubuntu-gui:~# npm -v
10.9.4
root@ubuntu-gui:~# curl -s https://packagecloud.io/install/repositories/SOLTECSIS/FWCloud/script.deb.sh?any=true | sudo bash
root@ubuntu-gui:~# sudo apt -y install mariadb-server
root@ubuntu-gui:~# systemctl status fwcloud-api.service

I will try to implement it on production server.
 

darkowl

New member
Just to double check I reverted to snapshot.
Standard Ubuntu 24.04 installation, fully updated:
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.14.0-37-generic x86_64)
0 updates can be applied immediately.

root@ubuntu-gui:~# apt-get update
root@ubuntu-gui:~# node -v
Command 'node' not found, but can be installed with:
apt install nodejs
root@ubuntu-gui:~# npm -v
Command 'npm' not found, but can be installed with:
apt install npm
root@ubuntu-gui:~# apt -y install nodejs npm mariadb-server
root@ubuntu-gui:~# curl -s https://packagecloud.io/install/repositories/SOLTECSIS/FWCloud/script.deb.sh?any=true | sudo bash
The repository is setup! You can now install packages.
root@ubuntu-gui:~# apt -y install fwcloud-api fwcloud-ui
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
fwcloud-api fwcloud-ui
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 136 MB of archives.
After this operation, 418 MB of additional disk space will be used.
Get:1 https://packagecloud.io/SOLTECSIS/FWCloud/any any/main amd64 fwcloud-api all 2.3.0 [55.9 MB]
Get:2 https://packagecloud.io/SOLTECSIS/FWCloud/any any/main amd64 fwcloud-ui all 2.3.0 [79.8 MB]
Fetched 136 MB in 2s (59.1 MB/s)
Selecting previously unselected package fwcloud-api.
(Reading database ... 266943 files and directories currently installed.)
Preparing to unpack .../fwcloud-api_2.3.0_all.deb ...
Unpacking fwcloud-api (2.3.0) ...
Selecting previously unselected package fwcloud-ui.
Preparing to unpack .../fwcloud-ui_2.3.0_all.deb ...
Unpacking fwcloud-ui (2.3.0) ...
Setting up fwcloud-api (2.3.0) ...
Certificate request self-signature ok
subject=O = SOLTECSIS - FWCloud.net, CN = fwcloud-api-H51fmH24u6PZAHMzHL4twmPGf1do5CBY
/opt/fwcloud/api/dist/src/sockets/messages/socket-message.js:41
const uuid = __importStar(require("uuid"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/fwcloud/api/node_modules/uuid/dist-node/index.js from /opt/fwcloud/api/dist/src/sockets/messages/socket-message.js not supported.
Instead change the require of index.js in /opt/fwcloud/api/dist/src/sockets/messages/socket-message.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/opt/fwcloud/api/dist/src/sockets/messages/socket-message.js:41:27)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/communications/ssh.communication.js:31:26)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/models/firewall/Firewall.js:96:29)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/models/firewall/Cluster.js:39:20)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/database/database.service.js:70:19)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/cli/commands/migration-reset-command.js:25:28)
at Object.<anonymous> (/opt/fwcloud/api/dist/src/cli/cli.js:24:35) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.19.1
/opt/fwcloud/api/dist/src/sockets/messages/socket-message.js:41
const uuid = __importStar(require("uuid"));
^
So Ubuntu still uses 18.19.1 and following the install guide will produce this error.

As for production system - I did install v22.22 yesterday, but apparently it was not used. Will try again today and post an update. Maybe I need to switch version using nvm...
 

Carles Munyoz

Administrator
Staff member
The problem is with the Node.js version. We have updated all NPM packages in order to avoid vulnerabilities and it is necessary at last Node.js 20.
We will update the installation documentation procedure and warn about this.

Thank you very much for your report and help.
 

darkowl

New member
I was able to update FWCloud. The correct order (which I somehow missed yesterday) was:
- Stop FWCloud services.
- Update Node JS to 22.22:
apt-get purge -y nodejs npm
apt autoremove
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
- Start services.
- Login and start autoupdate.
It does not finish, as autoupdater service updates itself and does not start. But after starting it manually it offers update again
- Update other services.

Everything seems to be resolved.

The key difference, I think, is to manually update Node.js BEFORE starting the update in web GUI. Yesterday I tried in the reverse order, but I had failed services which did not start after Node.js update anyway.
 

Carles Munyoz

Administrator
Staff member
Yes, the problem is with the Node.js version.
Versions before 20.x are no longer supported.

We have already developed a new version of FWCloud that verifies this before the update process and generates an error message if the Node.js version is not supported.

We are going to update the documentation in our website too.

Thank you very much for the report.
 

darkowl

New member
Sorry to bring this in this thread and without proper research...

TCP flags in the Dark theme appear to be invisible. Switching to light theme fixes it, but I am positive it was visible before.
Tried Chrome and Firefox.
 

Carles Munyoz

Administrator
Staff member
We have already updated the FWCloud installation documentation:

And we are preparing the update procedure to be able to detect the correct Node.js version before carry up the update procedure.

Thank you very much for your report.
 
Top