Trouble Connecting Fly.io App to MongoDB Atlas

I have a Fly.io app that I recently deployed, and I need it to connect to a MongoDB Atlas cluster.
My app works fine with local development and it also worked in other deploy service (render), but I’ve encountered connectivity issues with Fly.io.

The error is:

MongoDB connection failed: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted. Make sure your current IP address is on your Atlas cluster’s IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/

i already listed 0.0.0.0/0 in the whitelist of my cluster

Despite adding the static egress IP to my MongoDB Atlas whitelist, my app still fails to connect to the database. The error message indicates that it could not connect to any servers in my MongoDB Atlas cluster.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.