Unable to connect again to mongodb database after severel delete request

I have a web app hosted on cPanel with server connection to database on mogodb with M0 free tier.
It use to be working fine untill I tried several delete requests , my connecteion to the DataBase started to become refused.
How can I get access to the database again from my web server on cPanel, knowing that I’m still able to connect from my local machine.

Hi Noomen, Welcome!

I’m wondering if the IP address on your app instance changed… and the new IP is not allowed in your MongoDB Atlas IP access list.

To check… Go to your MongoDB Atlas dashboardNetwork AccessIP Whitelist, and make sure your cPanel server’s IP address is added. If the server’s IP changes frequently, you might want to consider using 0.0.0.0/0 temporarily (this allows all IPs), but this should be done with caution for security reasons.

Next, I’d verify that the user you’re using to connect from your app still has the correct permissions. If for some reason, the user’s role was modified, it could result in denied access.

In the Atlas dashboard, go to Database Access and ensure your user still has the readWrite role or whatever roles are necessary for your app.

Hope this helps… let us know how you make out.
Mike

1 Like

I tried 0.0.0.0/0 but still didn’t work (it was working before the issue with this config.)

I added all my DNS IP addresses and the web app hosting IP address, and still the same issue.

When I visit the nodejs web app link I get this message:
{
“message”: “Operation users.countDocuments() buffering timed out after 10000ms”,
“stak”: null
}

When I try to run the app using SSH terminal on my web app, I get this error:

Server running on port: 5000
MongooseServerSelectionError: 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/

Just to add that user is OK with read and write rights

see screenshot