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

Node Driver Hangs Indefinitely When Connecting Via SRV Record

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.0.7
    • Affects Version/s: 3.0.6
    • Component/s: None

      When connecting to a cluster using a SRV record, the Node driver hangs indefinitely if the read preference is primary and the first SDAM event returns a topology type of ReplicaSetNoPrimary, even though the cluster has a primary and is in a healthy state.

      Steps to reproduce:

      const { MongoClient } = require('mongodb');
      const client = new MongoClient(
       "mongodb+srv://<redacted>/admin?readPreference=primary&appname=MongoDB%20Compass%20Dev&authSource=admin&ssl=true",
       { readPreference: "primary", connectWithNoPrimary: true, checkServerIdentity: true, sslValidate: true }
      );
      client.connect((err, c) => {
        // This block will never get executed.
        console.log('in connected block');
        console.log(err);
        console.log(c);
      });
      

      Switching to primaryPreferred as the read preference will always connect.

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            durran.jordan@mongodb.com Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: