1
votes

I have NodeJs app on the Namecheap server. Mongo db is hosted on MongoLab. When trying to connect to the database with mongoose I'm getting the following error: Mongoose connection "error" event fired with: { MongoError: no primary found in replicaset

MONGO_URI=mongodb://username:[email protected]:27017,cluster0-shard-00-01-0dwia.mongodb.net:27017,cluster0-shard-00-02-0dwia.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority

Mongo: 4.0.12 Node: v9.11.2

I am able to connect to the database with the same url from my local machine. Does someone know what could be the issue?

1
You have to ask NameCheap to open the outgoing port for you.Synapsid Digital

1 Answers

0
votes

Seems like a connection issue with namecheap servers. I also suggest looking into heroku instead of namecheap servers.