Hasura uses old url on Heroku, how to make Hasura use the right connection string? #8812
Replies: 2 comments 8 replies
-
Hasura can pull connection strings for user databases from one of two places: connection strings stored in the metadata, or connection strings available as env vars referenced in the metadata. My best guess is that your metadata includes a reference to the old connection string via an environment variable that still has the older value. You should be able to check this in your console under database connections. Most likely this is configured using another environment variable, not As to why this is happening: as you know, hasura v2 does not use a dedicated environment variable to connect the user's database. For backwards compatibility reasons, when hasura starts for the first time with the Next time the server starts, hasura will use that existing metadata. At this point, changing the env var does not matter: metadata has already been initialized, and the env var to use for the This is of course easily fix by not relying on the backwards compatibly behavior and instead explicitly setting the env var yourself. |
Beta Was this translation helpful? Give feedback.
-
Did some testing and understood the problem, which is a bug. To start up, hasura needs to connect to a metadata database. There are 4 ways to provide the connection string for this database, in order of precedence:
This is a bug, IMHO. The Because it does not, currently your instance tries to start up by connecting to that database, and ignores the flag. There are a few ways to fix your problem:
Please let us know if this resolves your issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
This is a follow-up of #8759
I used to have a working Hasura on Heroku, which changed about a month ago. Heroku did data migration to another instance (so I have to use another connection string). Although I did change the
DATABASE_URL
in my Heroku settings, Hasura still seems to use the old connection string somewhere. See logs below:{"detail":{"info":{"database_url":"postgres://(redacted)@ec2-108-128-201-166.eu-west-1.compute.amazonaws.com:5432/d25u4bqll5rg1a","retries":1},"kind":"postgres_connection"},"level":"info","timestamp":"2022-08-17T04:20:16.030+0000","type":"startup"}
. That shouldn't fail (I can connect to that url without any issues from another hasura instance or from the Heroku CLI).{"detail":{"info":{"objects":[{"definition":"default","message":"connection to server at \"ec2-54-247-107-109.eu-west-1.compute.amazonaws.com\" (54.247.107.109), port 5432 failed: Connection timed out\n\tIs the server running on that host and accepting TCP/IP connections?\n"...
.I already added env variables
HASURA_GRAPHQL_METADATA_DATABASE_URL
andHASURA_GRAPHQL_DATABASE_URL
, still resulting in a connection failed.What am I missing? How come Hasura is still using an old connection string? (It can't be hard coded, so where is does Hasura get that string from?)
Thanks, Kurt
Beta Was this translation helpful? Give feedback.
All reactions