seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
926 stars 163 forks source link

Migrate mongo 8.2.3 unable to connect to mongodb #398

Closed krtk6160 closed 1 year ago

krtk6160 commented 3 years ago

Describe the bug When I run migrate-mongo status on v8.2.3 while port-forwarding a kubectl mongodb pod I get this error ->

ERROR: getaddrinfo ENOTFOUND mongodb-0.mongodb-headless.mainnet.svc.cluster.local MongoServerSelectionError: getaddrinfo ENOTFOUND mongodb-0.mongodb-headless.mainnet.svc.cluster.local
at Timeout._onTimeout (/home/krtk6160/.nvm/versions/node/v14.17.3/lib/node_modules/migrate-mongo/node_modules/mongodb/lib/sdam/topology.js:325:38)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)

However, doing the same on v8.2.2, I get the correct list of migrations I've already performed.

To Reproduce Steps to reproduce the behavior:

Expected behavior I expect it to display my migrations correctly, just like v8.2.2 does.

maxcian commented 2 years ago

same issue when I use 8.2.3 to connection localhost:27017 (e.g. run migrate-mongo status)

but use 8.2.2 is working correctly

john-funk commented 2 years ago

issue still exists in 9.0.0

EDIT: works for me when adding directConnection=true to the connection string

pflima92 commented 2 years ago

Thanks @Jay-Funk, directConnection worked as a workaround.

seppevs commented 1 year ago

See last comment for a workaround. Issue is not directly caused by migrate-mongo, so I'm closing this.