My postgres database is not working

I have a Remix project which utilizes postgres and prisma. I followed the following steps:

  1. fly launch
  2. I set the secrets using fly secrets set
  3. npx prisma migrate dev
  4. fly deploy
    Inside of my dashboard, I see that my site as well as my database was created successfully. When I visit the website URL, it loads properly. However, when I try to interact with the website in any way in which my database is involved, it does nothing. It seems like my database for some reason is not connected at all. If I click on the database URL inside my dashboard, I get the following error: “my-db.fly.dev ’s DNS address could not be found. Diagnosing the problem.” I tried adding an IPv4 address to the database but to no avail. Help would be appreciated.

Here are some error messages in my logs:
2024-02-05T14:28:30Z app[080e714c6d4e28] ewr [info]PrismaClientInitializationError:
2024-02-05T14:28:30Z app[080e714c6d4e28] ewr [info]Invalid prisma.question.findFirst() invocation:
2024-02-05T14:28:30Z app[080e714c6d4e28] ewr [info]Can’t reach database server at my-db.internal.flycast:5432
2024-02-05T14:28:30Z app[080e714c6d4e28] ewr [info]Please make sure your database server is running at my-db.internal.flycast:5432.

I am also getting this error: connection to server at “fdaa:6:1ce:a7b:cb:cec0:9b7a:2”, port 5433 failed: FATAL: role “repmgr” does not exist


Edit: I have been working through this and it seems a major issue is that I use Sqlite for prisma and postgres. I need to figure out how to migrate and seed the database using normal SQL I think.

Hi… It looks like there are two different things going wrong simultaneously…

(Maybe three, given your final edit.)

This should be my-db.flycast:5432 (without the .internal in the middle).

Typically this is configured in the DATABASE_URL secret.

This is pretty unusual; it came up once before when someone unknowingly attached a Stolon-era volume to a PG Flex image…

Was this database created by the recent fly launch, that you cited above?

What do the following tell you?

fly status        -a my-db
fly pg users list -a my-db
fly vol list      -a my-db  # ← particularly dates

This one is normal, since the Postgres machine usually isn’t connected to the public Internet.

(And it’s generally best to keep it that way, for security.)

It’s unfortunate that the dashboard GUI presents a prominent link, though.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.