Square Cloud stands out with its dynamic IP allocation, assigning a unique address with each application restart. Unlike static IPs, this dynamic approach enhances security by constantly changing the network footprint, making it more resilient against potential threats.
When does it occur?
When you are trying to connect your MongoDB Atlas database to your app hosted on Square Cloud, you may come across the following error:
MongoNetworkError: connection 0 to shard-xxx-xxx.mongodb.net:27017 closed
Why does it occur?
You will receive this error message if you have not included the MongoDB Atlas addresses, the IP where your app is hosted, on the whitelist.
How to fix
To fix this error, you need to whitelist the IP address, according to the mongodb documentation, you need to whitelist 0.0.0.0/0 IP address.
Congratulations! You have successfully whitelisted the IP address 0.0.0.0/0 for your MongoDB Atlas database. Now you can connect your database to your app hosted on Square Cloud.
If you continue to experience any issues, please don’t hesitate to contact our support team.