I keep on getting the error mongoose serever selection error despite allowing access from anywehere in my MongoDb Atlas. Do you have any solution to this

Hi @Kennedy_Wanjohi_Njiraini,

Seems like a generic connection failure so it’s hard to say what the root cause would be. I understand you’ve allowed access from anywhere but it’s also important to note that the error indicates that this is one “common” reason as opposed to the actual root cause. I’d recommend performing some network tests from the client failing to connect.

You can then possibly troubleshoot your network based off those results or perhaps it may be the incorrect cluster.

Regards,
Jason

Thank you so much for this. The problem still persists. I am using the exact code that I was using for the connection. It worked well at first before it started giving me errors.

  1. What were the results from the network tests linked from my previous reply from the client failing to connect at the moment? Could you paste those here?

  2. Can you also advise some further details of the environment where the machine is running? e.g. if you’re connecting from a VM hosted locally, from a server hosted on AWS, GCP, Azure, a containerised instance, etc.

  3. When was the last time the connection worked?

Lastly, check on the Atlas UI if it’s the right cluster and if it’s up and running (not paused etc.).

Regards,
Jason

These are the results of the network tests
connected to portquiz.net
escape character is ‘^]’.
connection closed by a foreign host.

Hi @Kennedy_Wanjohi_Njiraini,

It appears that result is not associated with the tests mentioned in my previous comments. Have you tried testing with network tests ?

In addition to that, please advise on the below 2 as well.

Regards,
Jason