RocketChat / RocketChat/Rocket.Chat

An error occurred when creating an index for collection "users: Server selection timed out after 30000 ms'

Open
#29,586 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:

Javascript Errorlog (seem to be in future.js but im not a js dev so i ain't sure)

Steps to reproduce:
  1. Visit https://hub.docker.com/_/rocket-chat
  2. run commands:
    docker run --name db -d mongo:4.0 --smallfiles --replSet rs0 --oplogSize 128
    docker exec -ti db mongo --eval "printjson(rs.initiate())"
    docker run --name rocketchat --link db --env MONGO_OPLOG_URL=mongodb://db:27017/local -d rocket.chat
  3. See Error Logs in portainer dashboard
Expected behavior:

After setting up all containers, I expect that the site on port 3000 load as expected, which hover is not the case.

Actual behavior:

After setting up mongodb & rocket.chat docker image, visiting the site on port 3000 don't seem to work and then, these error logs appear.

Server Setup Information:
  • Version of Rocket.Chat Server:
  • Operating System: Debian 10
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: /
  • NodeJS Version: /
  • MongoDB Version: latest / 4.4
Client Setup Information
  • Desktop App or Browser Version: Firefox 114.0.1 64-bit
  • Operating System: Windows 10
Relevant logs:

rocketchat logs:

/app/bundle/programs/server/node_modules/fibers/future.js:313
						throw(ex);
						^
errorClass [Error]: [An error occurred when creating an index for collection "users: Server selection timed out after 30000 ms]
    at Collection.createIndex (packages/mongo/collection.js:801:15)
    at setupUsersCollection (packages/accounts-base/accounts_server.js:1777: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 /app/bundle/programs/server/packages/accounts-base.js:2193:15
    at /app/bundle/programs/server/packages/accounts-base.js:2200:3
    at /app/bundle/programs/server/boot.js:369:38
    at Array.forEach (<anonymous>)
    at /app/bundle/programs/server/boot.js:210:21
    at /app/bundle/programs/server/boot.js:423:7
    at Function.run (/app/bundle/programs/server/profile.js:256:14)
    at /app/bundle/programs/server/boot.js:422:13 {
  isClientSafe: true,
  error: 'An error occurred when creating an index for collection "users: Server selection timed out after 30000 ms',
  reason: undefined,
  details: undefined,
  errorType: 'Meteor.Error'
}

mongodb logs:

t={"$date":"2023-06-20T09:45:17.634+00:00"} s=I c=- id=4939300 ctx=monitoring-keys-for-HMAC msg=Failed to refresh key cache attr={"error":"NotYetInitialized: Cannot use non-local read concern until replica set is finished initializing.","nextWakeupMillis":10000}

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

Start with the reported stack trace in packages/mongo/collection.js and packages/accounts-base/accounts_server.js:1777, then reproduce the listed Docker and MongoDB replica-set commands. Compare Rocket.Chat and MongoDB logs to isolate the index-creation timeout; done means the setup starts successfully and the site loads on port 3000 without this error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.