I am trying to connect my Heroku App, written in node.js, to a cluster hosted at Atlas MongoDB Cloud.
When running my api locally in my machine I can access the database with no problem using my current IP Address. I'm also able to connect to the cluster using mongo shell.
However, when running the App in Heroku, the connection cannot be established. In the Browser JS console,In heroku, I get the error:
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://docs.atlas.mongodb.com/security-whitelist/
I also try using some add-ons on Heroku like Fixie and Fixie Socks to get an Ip Address, still giving me the same Error.
My question is what do i need to do to establish the secure connection between Heroku and MongoDB Atlas?