Sava J
Sava J

Reputation: 1

MongoDB Atlas cluster could not connect

I'm currently trying to make a chat app with the help of MongoDB.

I keep on getting: Error connecting to MongoDB Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/

However everything I have is in order. My URL is correct (i'm certain). It contains the correct password and the IP I have on the cluster is 0.0.0.0.

I thought it had something to do with my firewall, but I realized that I literally don't have any.

Any idea what might be the issue? Any help would be appreciated.

MONGO_DB URL:

MONGO_DB_URI = mongodb+srv://savkecj:123456789%[email protected]/?retryWrites=true&w=majority&appName=Cluster1 password is literally 123456789!

Expecting to get a MongoDB successful connection message when I ran npm run server for my application but got the error instead.

Upvotes: 0

Views: 208

Answers (1)

sam
sam

Reputation: 1

Have you tried updating node.js to the latest version? See node.js download instructions.

I was having the same problem: I kept getting errors that my request was getting timed out or that it was a whitelisting issue when I'd been able to connect to the cluster just fine not long ago.

I'd allowed access from anywhere, reset my router, fiddled with DNS settings etc, and updating to the current version of node (22) fixed it for me.

Upvotes: 0

Related Questions