I'm running an application using Heroku's free plan. The application worked fine for more than half a year, but suddenly on 2021/2/24, it couldn't connect to DB (Postgres).
I tried to access the DB with Heroku CLI using a command posted on the dashboard, but there was no response from the DB. I ran the following command on Heroku CLI to get the credentials.
heroku pg:credentials:url -a app_name
When comparing the value obtained by Heroku CLI with the value on the dashboard, the host name of the DB server was different. (The DB name, DB user name, password, etc. other than the host name were all the same.)
So I updated the credentials with the following command.
heroku pg:credentials:rotate -a app_name
Then the host name of the DB server on the dashboard will be the same as the value obtained by Heroku CLI. After that, the application was able to connect to the DB.
I have some questions about the above.
Will the host of the DB (Postgres) server managed by Heroku change for any reason (eg maintenance or hardware failure)? Also, do I need to manually update the credentials in that case? The application reads credentials using environment variables. If the credentials change, they will be reflected in the application.
Why was the host name displayed on the dashboard different from the host name obtained by Heroku CLI? Is it possible to see incorrect information on the dashboard?
If anyone knows the cause, please teach me.
Only one DB is attached. I was using a DB that was automatically created with
If Heroku changes the default Database URL, do I have to manually restore the current credentials to the default?