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

Authentication attempts against arbiter node

      Whenever someone attempts to connect to a replica set, the driver tries to authenticate against the arbiter node.

      Test function:

      const MongoClient = require('mongodb').MongoClient;
      
      // Default replica set options 
      var replSetOpts = { 
          ha: true, 
          haInterval: 500, 
          reconnectWait: 5000, 
          poolSize: 5, 
          retries: 10000000, 
          socketOptions: { 
            connectTimeoutMS: 20000, 
            keepAlive: 1, 
            noDelay: true 
          }
      };
      
      const url = "mongodb://<user>:<pass>@primary:secondary/<datasbase>?replicaSet=<rs>"
      
      MongoClient.connect(url, replSetOpts, function(err, db) {
        if(err) {
          console.log('Error: %s', err)
          process.exit(1)
        } 
      
        console.log("Connected correctly to server");
        db.listCollections().toArray(function(err, items) {
          console.log(items);
          db.close();
        });
      });
      
      

      After running the test and successfully connecting, the arbiter is used for authentication:

      2017-04-09T16:22:07.270-0700 I ACCESS [conn244] SCRAM-SHA-1 authentication failed for <user> on <db> from client <IP> ; UserNotFound: Could not find user <user>@<db>

      If I remove haInterval, or increase it to a higher value, the problem seems to be mitigated but still happens, although less often.

      I noticed this bug was filled before, at https://jira.mongodb.org/browse/NODE-927

      Maybe it is still happening on the current version?

      Thanks,
      Victor.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            Vic Victor Martin [X]
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: