RocketChat / RocketChat/Rocket.Chat

errorClass [Error]: [An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND 908d46b110d7]

Open
#29,068 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Hi, I deploy Rocket.Chat according to https://docs.rocket.chat/deploy/prepare-for-your-deployment/other-deployment-methods/manual-installation/rocket.chat-in-centos
The following is my currently configured environment:

  • CentOS Streaming 9
  • MongoDB 5.0.5
  • Use the rocketchat deployment package downloaded from https://releases.rocket.chat/latest/download, which I believe is the latest stable version 6.1.5
  • Use the node version managed by nvm, the current node version is 14.21.3

I executed cd programs/server && npm install

[root@waterstone-server-234 Rocket.Chat]# cd programs/server && npm install
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/opt/Rocket.Chat/programs/server)
audited 158 packages in 1.348s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

I configured the required environment variables in .bash_profile:

[root@waterstone-server-234 Rocket.Chat]# cat ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
MONGO_URL=mongodb://192.168.31.234:27017/rocketchat?replicaSet=rs01
MONGO_OPLOG_URL=mongodb://192.168.31.234:27017/local?replicaSet=rs01
ROOT_URL=http://192.168.31.234:3000
PORT=3000

I also executed directly in the shell:

[root@waterstone-server-234 Rocket.Chat]# export MONGO_URL=mongodb://192.168.31.234:27017/rocketchat?replicaSet=rs01
[root@waterstone-server-234 Rocket.Chat]# export MONGO_OPLOG_URL=mongodb://192.168.31.234:27017/local?replicaSet=rs01
[root@waterstone-server-234 Rocket.Chat]# export ROOT_URL=http://192.168.31.234:3000
[root@waterstone-server-234 Rocket.Chat]# export PORT=3000

Finally I executed node main.js, but reported an error:

[root@waterstone-server-234 Rocket.Chat]# node -v
v14.21.3
[root@waterstone-server-234 Rocket.Chat]# node main.js 

/opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:313
						throw(ex);
						^
errorClass [Error]: [An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND 908d46b110d7]
    at Collection.createIndex (packages/mongo/collection.js:801:15)
    at setupUsersCollection (packages/accounts-base/accounts_server.js:1776:9)
    at new AccountsServer (packages/accounts-base/accounts_server.js:75:5)
    at packages/accounts-base/server_main.js:7:12
    at module (packages/accounts-base/server_main.js:19:31)
    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 /opt/Rocket.Chat/programs/server/packages/accounts-base.js:2192:15
    at /opt/Rocket.Chat/programs/server/packages/accounts-base.js:2199:3
    at /opt/Rocket.Chat/programs/server/boot.js:369:38
    at Array.forEach (<anonymous>)
    at /opt/Rocket.Chat/programs/server/boot.js:210:21
    at /opt/Rocket.Chat/programs/server/boot.js:423:7
    at Function.run (/opt/Rocket.Chat/programs/server/profile.js:256:14)
    at /opt/Rocket.Chat/programs/server/boot.js:422:13 {
  isClientSafe: true,
  error: 'An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND 908d46b110d7',
  reason: undefined,
  details: undefined,
  errorType: 'Meteor.Error'
}

This seems to be an error caused by not being able to connect to MongoDB, But I am very sure that my MongoDB can be connected, even if I am deploying on the internal network, the remote connection is enabled. I installed MongoDB 5.0.5 using Docker, here is mongod.conf.orig:

root@908d46b110d7:/etc# cat mongod.conf.orig
storage:
   dbPath: /var/lib/mongodb
   journal:
      enabled: true

engine: mmapv1

# wiredTiger:

replication:
  replSetName: rs01
 
systemLog:
   destination: file
   logAppend: true
   path: /var/log/mongodb/mongod.log
 
net:
   bindIp: 0.0.0.0
   port: 27017
 
processManagement:
   timeZoneInfo: /usr/share/zoneinfo

security: 
   authorization: disabled

I don't know what caused the error: An error occurred when creating an index for collection "users: getaddrinfo ENOTFOUND 908d46b110d7, I have been troubled by this problem for a long time, and I really hope to get a reply to solve this problem, thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the startup from programs/server with node main.js, then compare the MONGO_URL and MONGO_OPLOG_URL environment values with the MongoDB replica-set and network settings in mongod.conf.orig. Done means the Rocket.Chat package starts without the users index or ENOTFOUND error and the MongoDB connection is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
centos, docker, mongodb, node.js
Domain
backend, databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.