Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-753

MongoError: no primary found in replicaset

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.2.0, 2.2.1
    • Component/s: MongoDB 3.2
    • Labels:
    • Environment:
      Docker
      Node.js 6.2
      MongoDB: 3.2.6
      ReplicaSet with 2 members and one with highest priority (dev)

      I have a replicaset named rs0, with 2 members with 1 using priority 1. (I know it is not safe, it's a dev env) running inside docker containers and linked together.

      On my app, I linked the MongoDB containers as mdb-1 and mdb-2:

      `mongodb://mdb-1:27017,mdb-2:27017/dialonce?replicaSet=rs0`

      Then I get the error:
      ```
      [service-auth-3]2016-07-12T09:15:23.027769297Z error: MongoError: no primary found in replicaset
      [service-auth-3]2016-07-12T09:15:23.027807154Z at /usr/src/app/node_modules/mongodb-core/lib/topologies/replset.js:533:32
      [service-auth-3]2016-07-12T09:15:23.027812184Z at .<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/replset.js:376:24)
      [service-auth-3]2016-07-12T09:15:23.027815644Z at g (events.js:286:16)
      [service-auth-3]2016-07-12T09:15:23.027818112Z at emitOne (events.js:96:13)
      [service-auth-3]2016-07-12T09:15:23.027820600Z at emit (events.js:188:7)
      [service-auth-3]2016-07-12T09:15:23.027823340Z at .<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:289:21)
      [service-auth-3]2016-07-12T09:15:23.027826240Z at emitOne (events.js:96:13)
      [service-auth-3]2016-07-12T09:15:23.027828829Z at emit (events.js:188:7)
      [service-auth-3]2016-07-12T09:15:23.027831867Z at .<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:230:12)
      [service-auth-3]2016-07-12T09:15:23.027836363Z at g (events.js:286:16)
      [service-auth-3]2016-07-12T09:15:23.027838891Z at emitTwo (events.js:106:13)
      [service-auth-3]2016-07-12T09:15:23.027841347Z at emit (events.js:191:7)
      [service-auth-3]2016-07-12T09:15:23.027844241Z at Socket.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/connection.js:150:49)
      [service-auth-3]2016-07-12T09:15:23.027847013Z at Socket.g (events.js:286:16)
      [service-auth-3]2016-07-12T09:15:23.027849441Z at emitOne (events.js:96:13)
      [service-auth-3]2016-07-12T09:15:23.027853221Z at Socket.emit (events.js:188:7)
      [service-auth-3]2016-07-12T09:15:23.027855762Z at connectErrorNT (net.js:1015:8)
      ```

      It was working fine with 2.1.8, reverting to 2.1.8 fixes the issue.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            jmuller@dial-once.com Jonathan Muller
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: