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

Connection to replicaSet fails

    • Type: Icon: Question Question
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 3.5.0, 4.2.2, 4.9.1
    • Component/s: None
    • Labels:
    • Not Needed
    • Not Needed

      Hello,
      I am trying to set up a MongoDB Connection via the node driver. It works as expected when i connect to a regular database, but won't work with a replica set db.

      I have tried switching between different mongodb drivers (node) but with no success.

      Currently using:
        Node v16.17.0
        mongodb v4.9.1
        ubuntu v22
      typescript v4.8.2

      const uri = "mongodb://host:27017";

      const werden = {
      auth:

      { username: "xyz", password: "xyzPW" }

      ,
      ssl: true,
      sslCA: "path/to/self-signedCA",
      tlsAllowInvalidCertificates: true,
      replicaSet: "rs01",
      };

      it returns this error:

      ```
      MongoServerSelectionError: getaddrinfo EAI_AGAIN 3d58bb2f4108
      at Timeout._onTimeout (....../node_modules/mongodb/lib/sdam/topology.js:293:38)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7) {
      reason: TopologyDescription {
      type: 'ReplicaSetNoPrimary',
      servers: Map(1)

      { '3d58bb2f4108:27017' => [ServerDescription] }

      ,
      stale: false,
      compatible: true,
      heartbeatFrequencyMS: 10000,
      localThresholdMS: 15,
      setName: 'rs01',
      maxElectionId: new ObjectId("7fffffff0000000000000016"),
      maxSetVersion: 1,
      commonWireVersion: 0,
      logicalSessionTimeoutMinutes: null
      },
      code: undefined,
      [Symbol(errorLabels)]: Set(0) {}
      }
      ```

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            yanghi.bete@gmail.com y b
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: