MongoDB Atlas connection doesn't work on Heroku MongoDB Atlas connection doesn't work on Heroku heroku heroku

MongoDB Atlas connection doesn't work on Heroku


This problem might arise if you have only whitelisted your local IP. An easy workaround at the sacrifice of security is to whitelist any IP (0.0.0.0/0) in your MongoDB Atlas cluster. Or you could use VPC peering.


I know you have found Heroku, personally I would use repl.it as it doesn't require any money, with great up time, excellent support. You can run the bot for a long time unlike Heroku.

If you don't like switching have you used pymongo in the requirements.txt?


This is most likely a SSL certificate error. You can set your own ssl_certfile option while hosting the databse - you can find the documentation related to that here.

If that is not the case, I'd suggest looking at your server log files and checking out what the error is there.

Hope this helps!