MongooseServerSelectionError: 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

Today, I could finally get the same problem you are experiencing.

Then, I did a side-by-side test with replit and Compass. Removing and re-adding the access from everywhere. Compass had no problem connecting.

It seems the problem arises from the container (virtual machine) our repl is started. I got two different addressses that both succeeded portquiz.net test but one failed to connect mongodb:

23.251.145.77 → Failed
35.203.153.221 → Connected

I have sent a bug report within the repl. I can’t say what happens next. I suggest you close/reopen the repl by going back to “My Repls” page, waiting a bit, and re-open it. check if you connect. if not, try again.

1 Like