Hey @Ewan_Humbert - Firstly, welcome to the community
So I have a free cluster on MongoDB Atlas for my node.js app. When I was developing the app, the connection to the database worked perfectly fine. Now I have deployed this app on a server and I get an error to connect to the remote db
Regarding the above, could you advise on the following:
- If the exact same code is being used (at least for the connection portion)
- When the connection initially worked, was the app hosted locally on your device? E.g. on your laptop and connection was working fine to Atlas
- When you get the errors connecting from the server where the app is deployed, have you tested connection from the initial development machine to compare if it was working during the same period?
- Further details regarding the environment where the app fails to connect. E.g. Is this now hosted on AWS?
- Driver version
I would also recommend you to please try performing the initial basic network connectivity tests and provide the output for the cluster you are having trouble connecting to (from the server where you have deployed your app):
ping one of the hosts (prefereably the PRIMARY):
telnet to one of the hosts on port
telnet cluster0-shard-00-00.ze4cx.mongodb.net 27017
Note: You can find the hostname in the metrics page of your cluster
Additionally, I would recommend to review the Troubleshoot Connection Issues documentation. You may also find the following blog post regarding tips for atlas connectivity useful too.