"MongoError: no primary found in replicaset" when trying to connect to mongodb database locally or through our galaxy server

Hi all, we recently exported our mongodb from compose.io to ibm cloud. The export went successfully, but we can’t get it to work with meteor localy or with galaxy.

I have successfully gotten our .Net applications to connect to our new ibm hosted mongo DB, but am getting an error whenever i try with meteor locally or through our galaxy server:

2022-10-14 11:00:53-04:00 MongoError: no primary found in replicaset
2022-10-14 11:00:53-04:00  at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:449:15)
2022-10-14 11:00:53-04:00  at new MongoConnection (packages/mongo/mongo_driver.js:211:27)
2022-10-14 11:00:53-04:00  at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
2022-10-14 11:00:53-04:00  at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
2022-10-14 11:00:53-04:00  at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
2022-10-14 11:00:53-04:00  at new Mongo.Collection (packages/mongo/collection.js:99:40)
2022-10-14 11:00:53-04:00  at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
2022-10-14 11:00:53-04:00  at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
2022-10-14 11:00:53-04:00  at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
2022-10-14 11:00:53-04:00  at fileEvaluate (packages/modules-runtime.js:197:9)

Here is the current way i am calling my connection string with a “npm run win-start” command defined in our package.json:

"win-start": "SET MONGO_URL=mongodb://admin:[PASSWORD]@url1.databases.appdomain.cloud:31928,url2.databases.appdomain.cloud:31928,url3.databases.appdomain.cloud:31928/dyo?authSource=admin^&tls=true^&tlsInsecure=true^&connect=replicaSet^&replicaSet=replset && meteor --settings settings.json"

(notice the ^&, that’s the only way i could escape the ampersands and get the command to not error out. maybe that’s part of the problem)

So yeah, it might be a problem with how I’ve formatted/am calling the DB? Even trying to connect to our old compose server locally throws this same error (usually we just connect to a local DB). Any help is appreciated

  • MongoDB Version: 4.4
  • Meteor Version: 1.4.4.1

Is your current IP address whitelisted on your mongo host?

So my solution was to include the ssl flag in my connection string and set it to true, which for some reason worked… I’m pretty sure i read somewhere that that is deprecated though? Would whitelisting have also solved the issue?

I answered you on GitHub – it’s a problem of MongoDB driver version compatibility.