Application error in Heroku due to MongoDB? Application error in Heroku due to MongoDB? heroku heroku

Application error in Heroku due to MongoDB?


Sounds like you are being blocked by a firewall.

MongoDb Atlas recommends IP whitelisting as one of its security features - you can see whether this is set up in the portal under the cluster security settings. If it is set up (and not using the 0.0.0.0 wildcard) then you need to add your server(s) IP range to the whitelist. See https://docs.atlas.mongodb.com/security-whitelist/

*Disclaimer - I dont work with Heroku, so I'm not sure whether you need to open the 27017 port for your application as well. This article may be useful if your Heroku instance has dynamic IPs - https://www.mongodb.com/blog/post/integrating-mongodb-atlas-with-heroku-private-spaces


It is possible that u've configured mLab in heroku incorrectly you have to change the URI that heroku gives you, for the mongoAtlas one. As I was saying this "MONGOLAB_URI" is the one that you should change, check the following image.

MLab Settings

Hope this fixes your error, if it doesn't work then check this page (https://docs.mlab.com/connecting/). Even if then it does not work, read the disclaimer part.

  • Disclaimer - For possible future help, please send part of your node.js and mongoDB connection code.