'Bad Auth with mongoose when deploying NestJS app on Heroku

I'm trying to deploy my NestJS app on Heroku but now all of the sudden app is throwing Bad Auth error.

On the development it's all working fine.

This is the error I'm getting:

enter image description here


I'm storing the credentials in .env

enter image description here

Are these constants populated by Heroku with some unexpected values?


And I'm allowing the connection from every IP address: enter image description here

What is going on and how to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source