migrate-mongo
migrate-mongo copied to clipboard
Migrate mongo 8.2.3 unable to connect to mongodb
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.
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
issue still exists in 9.0.0
EDIT: works for me when adding directConnection=true
to the connection string
Thanks @Jay-Funk, directConnection
worked as a workaround.
See last comment for a workaround. Issue is not directly caused by migrate-mongo, so I'm closing this.