1

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.

  1. 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.

  2. 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.


Mar 8

Only one DB is attached. I was using a DB that was automatically created with heroku create. If Heroku changes the default Database URL, do I have to manually restore the current credentials to the default?

1
  • Do you have multiple DB attached? Also heroku does update the default Database URL environment variables automatically if the DB is changed because of some issue or maintenance
    – manjit5190
    Mar 1, 2021 at 9:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.