Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rocketchat not starting when upgrading from 3.7.2 to 3.8.0 #19537

Closed
MichaelSluydts opened this issue Nov 14, 2020 · 20 comments
Closed

Rocketchat not starting when upgrading from 3.7.2 to 3.8.0 #19537

MichaelSluydts opened this issue Nov 14, 2020 · 20 comments

Comments

@MichaelSluydts
Copy link

Description:

Rocketchat fails to start after updating from 3.7.2 to 3.8.

Steps to reproduce:

sudo systemctl stop rocketchat
sudo rm -rf /opt/Rocket.Chat
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
tar -xzf /tmp/rocket.chat.tgz -C /tmp
cd /tmp/bundle/programs/server && npm install
sudo mv /tmp/bundle /opt/Rocket.Chat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
sudo systemctl start rocketchat

Expected behavior:

Rocketchat will work.

Actual behavior:

It no longer starts, see logs below.

Server Setup Information:

  • Version of Rocket.Chat Server: 3.7.2
  • Operating System: CentOS 8
  • Deployment Method: tar
  • Number of Running Instances: 1
  • NodeJS Version: 13.2
  • MongoDB Version: 4.0.19

Client Setup Information

not relevant

Relevant logs:

Nov 14 03:54:53 xxx.eu rocketchat[4845]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Nov 14 03:54:53 xxx.eu rocketchat[4845]: throw(ex);
Nov 14 03:54:53 xxx.eu rocketchat[4845]: ^
Nov 14 03:54:53 xxx.eu rocketchat[4845]: TypeError: AsyncLocalStorage is not a constructor
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at module (server/sdk/index.ts:23:34)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at fileEvaluate (packages/modules-runtime.js:336:7)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Module.require (packages/modules-runtime.js:238:14)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_module>
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at ee/server/broker.ts:1:80
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at module (ee/server/broker.ts:345:2)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at fileEvaluate (packages/modules-runtime.js:336:7)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Module.require (packages/modules-runtime.js:238:14)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_module>
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at module (server/main.js:1:8)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at fileEvaluate (packages/modules-runtime.js:336:7)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Module.require (packages/modules-runtime.js:238:14)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at require (packages/modules-runtime.js:258:21)
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at /opt/Rocket.Chat/programs/server/app/app.js:191678:15
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at /opt/Rocket.Chat/programs/server/boot.js:401:38
Nov 14 03:54:53 xxx.eu rocketchat[4845]: at Array.forEach ()
Nov 14 03:54:53 xxx.eu systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE

@Slupi
Copy link

Slupi commented Nov 14, 2020

I had the same issue. A node update to version 12.18.4 fixed the problem for me.

@jacotec
Copy link

jacotec commented Nov 14, 2020

Confirm @Slupi , made the same experience.

@fallen
Copy link

fallen commented Nov 14, 2020

Same issue here with node 12.19.0

@irgendwie
Copy link

irgendwie commented Nov 14, 2020

Maybe some of you fell into the same pit as me (manual installation on Ubuntu 20.04) - Rocket.Chat doesn't seem to use the system's version of node but instead relies on the n managed version (compare https://docs.rocket.chat/installation/manual-installation/ubuntu).

Check the output of:
/usr/local/bin/node --version
and:
/usr/bin/node --version

As a solution I ended up with symlinking the /usr/bin/node binary to /usr/local/bin/node while removing the n managed version stuff with sudo n uninstall.

Edit: This way Rocket.Chat uses node 12.19.0 (system's version) and executing correctly for me.

@MichaelSluydts
Copy link
Author

I confirm installing the specific version of 12.18.4 through n fixes the problem, which I guess is indeed the listed version. Not sure if we expect compatibility with any other versions. Should I close this or leave it for further investigation?

@fallen
Copy link

fallen commented Nov 14, 2020

I'm on Debian Stretch 9.13, what fixed my issue was installing node 12.18.4 using 'n' by doing:

$ sudo n install 12.18.4
$ /usr/local/bin/node --version
v12.18.4

By default, following the install documentation ( https://docs.rocket.chat/installation/manual-installation/debian/ ) had me install NodeJS 12.19.0

@irgendwie
Copy link

By default, following the install documentation ( https://docs.rocket.chat/installation/manual-installation/debian/ ) had me install NodeJS 12.19.0

Yes and no - it install 12.19.0 (current version of node-js supplied through the debian package). Later in the guide the specific version 12.14.0 gets installed (under /usr/local/bin/ - higher preference in the PATH):

sudo npm install -g inherits n && sudo n 12.14.0

As 12.14.0 doesn't seem to be current enough anymore you can either install 12.18.4 (as many did) but 12.19.0 (supplied through the debian package) seems to also be fine:

Nov 14 14:39:28 omitted rocketchat[29903]: ➔ +---------------------------------------------------+
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | SERVER RUNNING |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ +---------------------------------------------------+
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | Rocket.Chat Version: 3.8.0 |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | NodeJS Version: 12.19.0 - x64 |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | MongoDB Version: 4.0.21 |

@binarydad
Copy link

I'm on Debian Stretch 9.13, what fixed my issue was installing node 12.18.4 using 'n' by doing:

$ sudo n install 12.18.4
$ /usr/local/bin/node --version
v12.18.4

By default, following the install documentation ( https://docs.rocket.chat/installation/manual-installation/debian/ ) had me install NodeJS 12.19.0

Worked for Ubuntu 18.04 as well.

@mr-bobdobalina
Copy link

Confirming for CentOS 7 running:
sudo n install 12.18.4

Then following the standard manual upgrade procedure fixed the issue.

@fallen
Copy link

fallen commented Nov 15, 2020

By default, following the install documentation ( https://docs.rocket.chat/installation/manual-installation/debian/ ) had me install NodeJS 12.19.0

Yes and no - it install 12.19.0 (current version of node-js supplied through the debian package). Later in the guide the specific version 12.14.0 gets installed (under /usr/local/bin/ - higher preference in the PATH):

sudo npm install -g inherits n && sudo n 12.14.0

As 12.14.0 doesn't seem to be current enough anymore you can either install 12.18.4 (as many did) but 12.19.0 (supplied through the debian package) seems to also be fine:

Nov 14 14:39:28 omitted rocketchat[29903]: ➔ +---------------------------------------------------+
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | SERVER RUNNING |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ +---------------------------------------------------+
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | Rocket.Chat Version: 3.8.0 |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | NodeJS Version: 12.19.0 - x64 |
Nov 14 14:39:28 omitted rocketchat[29903]: ➔ | MongoDB Version: 4.0.21 |

You're actually right, one would need to edit the tutorial I guess.

@fallen
Copy link

fallen commented Nov 15, 2020

I've proposed a PR to update the manual install doc => https://github.com/RocketChat/docs/pull/1826

@desser-code
Copy link

sudo n install 12.18.4 worked for me too. I think this can be closed.

@ybshin
Copy link

ybshin commented Nov 18, 2020

I can't install 12.18.4 with sudo n install 12.18.4

so used this command

NODE_MIRROR=https://nodejs.org/dist/ n 12.18.4

@wesleyguirra
Copy link

wesleyguirra commented Nov 19, 2020

I'm using node 12.19.1, I'm not able to start the server using command node main.js that returns the following:

/root/rocket-chat/programs/server/node_modules/fibers/future.js:280
						throw(ex);
						^
TypeError: Cannot read property 'includes' of undefined
    at module (packages/rocketchat:mongo-config/server/index.js:32:28)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at require (packages/modules-runtime.js:258:21)
    at /root/rocket-chat/programs/server/packages/rocketchat_mongo-config.js:128:15
    at /root/rocket-chat/programs/server/packages/rocketchat_mongo-config.js:133:3
    at /root/rocket-chat/programs/server/boot.js:401:38
    at Array.forEach (<anonymous>)
    at /root/rocket-chat/programs/server/boot.js:226:21
    at /root/rocket-chat/programs/server/boot.js:464:7
    at Function.run (/root/rocket-chat/programs/server/profile.js:280:14)
    at /root/rocket-chat/programs/server/boot.js:463:13

I also tried to start service via systemd using systemctl start rocketchat and systemctl status rocketchat returns:

● rocketchat.service - The Rocket.Chat server
   Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-11-19 12:31:29 UTC; 5s ago
  Process: 13793 ExecStart=/usr/local/bin/node /root/rocket-chat/main.js (code=exited, status=1/FAILURE)
 Main PID: 13793 (code=exited, status=1/FAILURE)

Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]: Error: Cannot find module '/root/rocket-chat/main.js'
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:     at Function.Module._load (internal/modules/cjs/loader.js:687:27)
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:     at internal/main/run_main_module.js:17:47 {
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:   code: 'MODULE_NOT_FOUND',
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]:   requireStack: []
Nov 19 12:31:29 digital-heroes-ubuntu rocketchat[13793]: }
Nov 19 12:31:29 digital-heroes-ubuntu systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE
Nov 19 12:31:29 digital-heroes-ubuntu systemd[1]: rocketchat.service: Failed with result 'exit-code'.

I've tried versions 3.7.2, 3.2.0, 2.4.9.

Someone can help?

@irgendwie
Copy link

Did you run npm install after changing the node version? The node modules depend on the node version you are using.

@wesleyguirra
Copy link

@irgendwie Yes

@wesleyguirra
Copy link

wesleyguirra commented Nov 19, 2020

Update

I've tried node versions using n: 12.18.4, 12.19.0 12.19.1.

every version returns the same error after trying command node main.js

I've deleted and run npm install between node version change.

when I set the env var for MONGO_URL the error gone but the command node main.js don't return anything, after a while it shows only one line that says: Killed

@xi67
Copy link

xi67 commented Nov 20, 2020

On Debian 10 (buster), as suggested on a previous comment, i've symlink system NJS to local dir :
/usr/local/bin/node --version
v12.14.0
/usr/bin/node --version
v12.19.1
node --version
v12.14.0

mv /usr/local/bin/node /usr/local/bin/node.old
ln -s /usr/bin/node /usr/local/bin/node

node --version
v12.19.1

It works :
Rocket.Chat Version: 3.8.1
NodeJS Version: 12.19.1 - x64
MongoDB Version: 4.2.11

@wesleyguirra
Copy link

My problem was too: first I forgot to set env var for MONGO and second my droplet on digital ocean hasn't enough ram to run the server.

I simply stop all processes that was running in droplet, start the server, then I start other proccesses again.

frdmn pushed a commit to RocketChat/docs-old that referenced this issue Nov 26, 2020
Without this change, RocketChat does not start anymore with NodeJS 12.14.0.

Resolves RocketChat/Rocket.Chat#19537
@frdmn
Copy link
Contributor

frdmn commented Nov 26, 2020

Docs should be updated now. Thanks for reporting/contributing everyone! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests