Cannot connect to external mongodb server

I have a Python project, but I am not able to connect to the database.

The Mongodb Server is working fine, also with other projects.
Are there any limitations on outgoing connections, when not running a Flask Server?

Failed to connect to MongoDB: No servers found yet, Timeout: 5.0s, Topology Description: <TopologyDescription id: 67d2e2c7a1f4923fb012aca2, topology_type: Unknown, servers: [<ServerDescription (‘XXX.XXX.XXX’, 27017) server_type: Unknown, rtt: None>]>

Have you enabled the public port? That would allow you to connect to the server.

You must also grab the auth token to pass with the request too.

For reference:

The python project on IDX cannot connect to a server that is located somewhere else.
I don’t have any problems connecting with the same script from my local machine to the mongodb, but on IDX I cannot establish any connection to it.
I guess it’s not the Backend Port then, correct?

Any ports need to be open on the IDX side to connect to it, but the auth token is important as it will not accept requests without it

I might not understand correctly. Is it something that recently changed on IDX?
It was working without any problems a while ago. Now it does not work on any project I have.

I have port 9000 as public address, and added 27017 for mongodb (like on the db server).
But it does not show up in the List of “Backend Ports”, but over the shift+cmd+p (get public ports) it is listed.

Also, I am not sure what you mean by auth token. The Credentials for the URI?mongodb://CREDENTIALS:CREDENTIALS@example.com:27017/

Can you try with the new official MongoDB template?

With the template it says “no running server found” at the backend ports section, but I can access with the test db with mongo extention locally.

Could it be related to my account on project.idx?

There should not be a reason why it is account related and either the port is not getting picked up properly in the IDX extension or the wrong port is being used.

Does it work in the command line for you?

No, I cannot get a connection with ping, nc, curl, telnet,… All have a timeout.

Have you checked the MongoDB Atlas console? Connection timeouts often happen because your workspace IP might have changed and is no longer in the whitelist. Try setting the whitelisted IP to 0.0.0.0/0 (allow access from anywhere) and test again. This should help if the issue is related to IP restrictions, which is common when working in environments where your IP address might change.

Restart your device and try it