I have NextJS app that has backend routes inside where I connect to the database. Everything works fine locally and I don’t get any errors but as soon as I deploy the app to the server I start getting this error:
Error connecting to the database: 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://mongodb.prakticum-team.ru/docs/atlas/security-whitelist/
I have whitelisted my IP address, IP address of my website and also whitelisted all IP addresses with 0.0.0.0/0 but the error persists.