Rocket.chat: Error getting MongoDB version

Created on 28 Apr 2019  路  8Comments  路  Source: RocketChat/Rocket.Chat

Description:

Steps to reproduce:

  1. Update to 1.0.0
  2. Watch the logs
  3. Observe Errors:
    Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB version
    Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB info

Expected behavior:

RC should be able to query the MongoDB verision.

Actual behavior:

Output:
Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB version
Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB info

Server Setup Information:

  • Version of Rocket.Chat Server: 1.0.0
  • Operating System: Ubuntu 18.04
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: 1
  • NodeJS Version: 8.16.0
  • MongoDB Version: 3.6.3 (Ubuntu 18.04 dist package)

Additional context

Server is runnning so far on this setup. I only saw the error messages above, which I wanted to report.

Relevant logs:

During Rocketchat Startup:

Apr 28 13:15:04 systemd[1]: Started The Rocket.Chat server.
.................
Apr 28 13:15:21 rocketchat[10219]: Updating process.env.MAIL_URL
Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB version
Apr 28 13:15:22 rocketchat[10219]: Error getting MongoDB info
Apr 28 13:15:22 rocketchat[10219]: Exception in setTimeout callback: TypeError: Invalid Version: Error getting version
Apr 28 13:15:22 rocketchat[10219]: at new SemVer (/opt/Rocket.Chat/programs/server/npm/node_modules/semver/semver.js:312:11)
Apr 28 13:15:22 rocketchat[10219]: at Range.test (/opt/Rocket.Chat/programs/server/npm/node_modules/semver/semver.js:1137:15)
Apr 28 13:15:22 rocketchat[10219]: at Function.satisfies (/opt/Rocket.Chat/programs/server/npm/node_modules/semver/semver.js:1189:16)
Apr 28 13:15:22 rocketchat[10219]: at server/startup/serverRunning.js:65:15
Apr 28 13:15:22 rocketchat[10219]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
Apr 28 13:15:22 rocketchat[10219]: at packages/meteor.js:620:25
Apr 28 13:15:22 rocketchat[10219]: at runWithEnvironment (packages/meteor.js:1356:24)

Most helpful comment

I spent a couple of hours debugging this and here is the solution. I suppose you've set up MongoDB Replicaset rsXX beforehand:

mongo -u ADMINUSER --authenticationDatabase admin -p
# enter password
> admin = db.getSiblingDB("admin");
> admin.grantRolesToUser('OPLOGUSER',[{ role: "clusterMonitor", db: "admin" }])
> admin.grantRolesToUser('ROCKETUSER',[{ role: "clusterMonitor", db: "admin" }])
> exit

# edit the /etc/systemd/system/rocketchat.service unit file to auth against the admin db in both cases:
MONGO_URL=mongodb://ROCKETUSER:ROCKETPASS@localhost:27017/rocketchat?authSource=admin MONGO_OPLOG_URL=mongodb://OPLOGUSER:OPLOGPASS@localhost:27017/local?authSource=admin&replSet=rsXX

systemctl daemon-reload && systemctl restart rocketchat.service && journalctl -xef
# should start up normally

A few links that helped me to solve the same problem:

All 8 comments

I spent a couple of hours debugging this and here is the solution. I suppose you've set up MongoDB Replicaset rsXX beforehand:

mongo -u ADMINUSER --authenticationDatabase admin -p
# enter password
> admin = db.getSiblingDB("admin");
> admin.grantRolesToUser('OPLOGUSER',[{ role: "clusterMonitor", db: "admin" }])
> admin.grantRolesToUser('ROCKETUSER',[{ role: "clusterMonitor", db: "admin" }])
> exit

# edit the /etc/systemd/system/rocketchat.service unit file to auth against the admin db in both cases:
MONGO_URL=mongodb://ROCKETUSER:ROCKETPASS@localhost:27017/rocketchat?authSource=admin MONGO_OPLOG_URL=mongodb://OPLOGUSER:OPLOGPASS@localhost:27017/local?authSource=admin&replSet=rsXX

systemctl daemon-reload && systemctl restart rocketchat.service && journalctl -xef
# should start up normally

A few links that helped me to solve the same problem:

Made some edits above to include the involved try-catch blocks + correct some typos. Hope it helps!

@oliob do you have mongo auth as suggested by @immanuelfodor ?

@geekgonecrazy yes I have mongo auth enabled.

@immanuelfodor Thank you for you guidance. It worked.

I ll close this. A section in the docs about this might be helpful.

Agreed! I'll see about getting this added

There is a nice error message added in #14320. Sadly, people don't use the Github search and went all over it again in #14303 to debug the same issue but at least there is an explanation for others next time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlprieb picture karlprieb  路  3Comments

Buzzele picture Buzzele  路  3Comments

brendanheywood picture brendanheywood  路  3Comments

mddvul22 picture mddvul22  路  3Comments

amayer5125 picture amayer5125  路  3Comments