I have tried searching online and most of the solutions point to the Network Access section of Atlas.
I have allowed access to all ips, but i still get the same error.
I’m using Node.js.
Here is the code i’m using to connect if it’s any help:
Could you please try connecting to your Atlas cluster via Mongo Shell or Compass?
If your URI is valid and you are able to establish a connection then, the next most common reason for such connection issues is either your IP address is not whitelisted (you have whitelisted your IP/ Allow access to all IPs) or port 27017 is blocked by either your IT department or your Internet Service Provider.
Can you try below command in your terminal to make sure port 27017 is open for you?
As you are able to connect to your Atlas Cluster using Compass means your Atlas cluster is working as expected and there are no connection issues between your machine and Atlas.
Can you reconfirm if your Connection string is correct and the user your are trying to connect with is having all the required access?
Have you added 0.0.0.0/0 in the IP access list of your Atlas cluster?
If not, please double check the whitelist includes the host IP your app is running on.
There could be many other other cases such as
Firewall is blocking the connection (disable firewall and try again)
Application environment might have some issue, it could also happen due to system settings such as mis-matched server’s date & time.
Check that the database exists and you are connecting to the correct one in the yourDatabaseName slot
In case, you are using any proxy or certificate based internet then such issues can rise. Try connecting via different internet connection.
Above are some of the most common reasons for connection issues.