When trying to connect to a database hosted on Digital Ocean via Prisma, I get a Can't reach database server
error:
024-07-31T14:14:56Z app[e82d393f7e29d8] sjc [info]Prisma schema loaded from prisma/schema.prisma
2024-07-31T14:14:56Z app[e82d393f7e29d8] sjc [info]Datasource "db": PostgreSQL database "nestor_app_clyh0gc190000el15bad3bfiz", schema "public" at "app-d21e13ba-5da3-4850-9d2e-5cbe054d8531-do-user-17210814-0.b.db.ondigitalocean.com:25060"
2024-07-31T14:14:56Z app[e82d393f7e29d8] sjc [info]Database changes detected: skipping push. Error message:
2024-07-31T14:14:56Z app[e82d393f7e29d8] sjc [info] Error: P1001: Can't reach database server at `app-d21e13ba-5da3-4850-9d2e-5cbe054d8531-do-user-17210814-0.b.db.ondigitalocean.com:25060`
2024-07-31T14:14:56Z app[e82d393f7e29d8] sjc [info]Please make sure your database server is running at `app-d21e13ba-5da3-4850-9d2e-5cbe054d8531-do-user-17210814-0.b.db.ondigitalocean.com:25060`.
I verified that the exact same code with the exact same DATABASE_URL env running locally can reach the db.
I use the Machine API with this config:
image: "registry.fly.io/nestor-flyapp:nestor-flyapp-image",
services: [{
protocol: "tcp",
ports: [
{
port: 80,
handlers: ["http"],
force_https: true
},
{
port: 443,
handlers: ["tls", "http"]
},
],
internal_port: 3001
}],
guest: {
cpu_kind: "shared",
cpus: 1,
memory_mb: 2048,
}
I also tried to connect manually to the db using psql
command directly on the machine (via fly console
) and it hangs.
I’m considering moving my dbs to Fly as well but I’d like to make sure everything works first. I’d also need a fully managed db with a REST API (I saw that supabase is in alpha, will that include the supabase REST API? Happy to be an alpha tester if yes).