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

Investigate NODE-4351 - MongoClient ignores passed url and always use localhost

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 2
    • Not Needed

      NODE-4351 Description

      What problem are you facing?

      While trying to connect to our mongodb at `mongo`, the driver tries to connect to localhost and times out:

      ```
      > (node:8625) UnhandledPromiseRejectionWarning: MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
      at Timeout._onTimeout (/builds/seervision/main/svms/node_modules/mongodb/lib/sdam/topology.js:312:38)
      at listOnTimeout (internal/timers.js:557:17)
      at processTimers (internal/timers.js:500:7)
      (Use `node --trace-warnings ...` to show where the warning was created)
      (node:8625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see
      https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
      ). (rejection id: 1)
      (node:8625) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
      ```

      What driver and relevant dependency versions are you using?

      Node `mongodb`  `4.7.0`

      Steps to reproduce?

      Have a mongo database running on any host but localhost. 

      ```
      const mongo = require('mongodb');
      const uri = "
      [mongodb://172.17.0.2:27017]
      "
      client = new mongo.MongoClient(uri)
      client.connect()
      ```

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            dbeng-pm-bot PM Bot
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: