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

`useUnifiedTopology` ignores `connectTimeoutMS` if there's an invalid domain name

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.3.3
    • Component/s: None
    • Labels:

      The below script's behavior changed significantly between v3.3.2 and v3.3.3

      'use strict';
        
      const mongodb = require('mongodb');
      
      run().catch(error => console.log('Caught', error));
      
      async function run() {
        const uri = 'mongodb://bad.notadomain:27017/test';
        const client = await mongodb.MongoClient.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true });
        console.log('Connected');
      
        await client.db().collection('test').findOne({});
        console.log('done');
      }
      

      Without `useUnifiedTopology`, it fails fast with the below error message:

      failed to connect to server [bad.notadomain:27017] on first connect
      

      With `useUnifiedTopology` as of v3.3.3, the script hangs for 30 seconds and finally errors out with `Server selection timed out after 30000 ms`. Is this intentional?

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            val@karpov.io Valeri Karpov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: