migrate-mongo icon indicating copy to clipboard operation
migrate-mongo copied to clipboard

Migrate mongo 8.2.3 unable to connect to mongodb

Open krtk6160 opened this issue 2 years ago • 3 comments

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:

  • Run kubectl port-forward mongodb-0 27017
  • Run migrate-mongo status in an already initialized directory

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

krtk6160 avatar Sep 28 '21 09:09 krtk6160

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

maxcian avatar Nov 12 '21 08:11 maxcian

issue still exists in 9.0.0

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

john-funk avatar Apr 08 '22 20:04 john-funk

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

pflima92 avatar Jun 28 '22 20:06 pflima92

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

seppevs avatar Sep 27 '23 07:09 seppevs