RocketChat / RocketChat/Docker.Official.Image

Can't connect to MongoDB

Open
#167 26 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
337
Forks
228
Avg merge
3d 10h
Merged PRs (30d)
5

Description

MongoServerSelectionError: Server selection timed out after 30000 ms
    at Timeout._onTimeout (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/sdam/topology.js:312:38)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'ReplicaSetNoPrimary',
    servers: Map(1) {
      'mongodb:27017' => ServerDescription {
        _hostAddress: HostAddress { isIPv6: false, host: 'mongodb', port: 27017 },
        address: 'mongodb:27017',
        type: 'RSGhost',
        hosts: [],
        passives: [],
        arbiters: [],
        tags: {},
        minWireVersion: 0,
        maxWireVersion: 9,
        roundTripTime: 11,
        lastUpdateTime: 809068,
        lastWriteDate: 0,
        topologyVersion: {
          processId: ObjectId { [Symbol(id)]: [Buffer [Uint8Array]] },
          counter: 0
        },
        logicalSessionTimeoutMinutes: 30
      }
    },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: 'rs0',
    commonWireVersion: 9,
    logicalSessionTimeoutMinutes: undefined
  }
}

I fresh installed with docker compose up -d and then it run.

RocketChat container gives me this error every 30 seconds and crashes. There are no other logs on that container.

{"t":{"$date":"2022-07-25T12:46:03.855+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.18.0.3:42482","connectionId":20,"connectionCount":2}}
{"t":{"$date":"2022-07-25T12:46:03.856+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn20","msg":"client metadata","attr":{"remote":"172.18.0.3:42482","client":"conn20","doc":{"driver":{"name":"nodejs","version":"4.3.1"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.10.104-linuxkit"},"platform":"Node.js v14.19.3, LE (unified)|Node.js v14.19.3, LE (unified)"}}}

In the MongoDB log I get this message that Connection from IP 172.18.0.3 (rocketChat) was accepted. I tried to reinstall the whole docker compose ecosystem even deleting and pulling the images again but it doesn't work.

Contributor guide

No contributing guide indexed for this repository

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 docker compose up -d and compare the Rocket.Chat and MongoDB container logs, focusing on the mongodb:27017 endpoint and the rs0 replica-set state shown in the error. Confirm that MongoDB has a primary and that the containers can communicate; done means Rocket.Chat stays running without repeated server-selection timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb, nodejs
Domain
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.