My node app gives me this message \"Could not connect to any servers in your MongoDB Atlas cluster. Make sure your current IP address is on your Atlas cluster\'s IP whitelist\"
Not sure if it is the right reason. But, its working for me when i disconnect the VPN.
When connected to VPN, I'm getting below error message.
Error: "Could not connect to any servers in your MongoDB Atlas cluster. Make sure your current IP address is on your Atlas cluster's IP whitelist".
Try keeping these questions in mind when you face such an issue with your mongodB that:
Did I changed my IP address before I started working with my mongodb again after a long break? If no, then please change it because usually mongodb removes it after every 6 hours.
Did I moved from the place where I worked last time? If yes, then please change your IP again and activate it.
Please do visit the link https://studio3t.com/knowledge-base/articles/mongodb-atlas-login-ip-whitelisting/#whitelist-multiple-or-additional-ip-addresses and learn more about why you get such error and how deal with them. It helps a lot.
Are you using proxy?? please try with different internet connection first.
Try doing this:- MongoDB Atlas
-> NetworkAccess
-> Edit
-> Allow Any
This worked for me!
To whitelist an IP address, go to your target cluster on MongoDB Atlas. Next, go to Network Access under the Security tab. On the IP Whitelist tab, click on Add IP address. Type your IP address manually under Whitelist Entry, then click Confirm. run your code it should run without any problem.
It's not always problem with the ip. Can have problem in db name , username or password.Then also connection failed.