I have a postgres database attached to my app. (SSH into app and
echo $DATABASE_URL works. My app is based on NodeJS and I followed the docs (https://fly.io/docs/reference/postgres/#about-postgres-on-fly) and installed Prisma. But when I do
npx prisma db pull, it says:
Datasource "db": PostgreSQL database "ttssd", schema "public" at "top2.nearest.of.ttssd-db.internal:5432"
✖ Introspecting based on datasource defined in prisma/schema.prisma
Can't reach database server at `top2.nearest.of.ttssd-db.internal`:`5432`
Please make sure your database server is running at `top2.nearest.of.ttssd-db.internal`:`5432`.
what can i do?
Hey there-- I’m not sure why this failed either. Depending on when you first saw this issue, we did have an incident yesterday that could have caused this problem. Are you still facing this error?
You may have already tried some of these steps, but in any case you’d likely also want to test for the following:
that you can reach the database from the app: you could do this with something like
fly ssh console -a <app-name> and attempting to ping the postgres app.
that the hostname resolves to the correct IPv6 address from the app: you can do this by running
dig aaaa top2.nearest.of.ttssd-db.internal (you may need to install the
bind-tools on your app to grab this).
that the database is healthy: you can catch many issues with
fly logs -a <pg-app> and/or
fly checks list -a <pg-app>
Hopefully this output will help you narrow things down a bit!