Hello,
I cannot figure out how to reach my fly.io postgres container from a Nextjs 13 (Prisma DB) app deployed on Vercel.
I have followed the guide on external connections and added an ipv6 address. The ipv4 address costs 2$/month, so I opted for ipv6.
My (auto-generated) fly.toml
looks like this:
app = "<my postgres app name>"
primary_region = "<region>"
[env]
FLY_SCALE_TO_ZERO = "1h"
PRIMARY_REGION = "<region>"
[[mounts]]
source = "pg_data"
destination = "/data"
[[services]]
protocol = "tcp"
internal_port = 5432
auto_start_machines = true
[[services.ports]]
port = 5432
handlers = ["pg_tls"]
[services.concurrency]
type = "connections"
hard_limit = 1000
soft_limit = 1000
[[services]]
protocol = "tcp"
internal_port = 5433
auto_start_machines = true
[[services.ports]]
port = 5433
handlers = ["pg_tls"]
[services.concurrency]
type = "connections"
hard_limit = 1000
soft_limit = 1000
[checks]
[checks.pg]
port = 5500
type = "http"
interval = "15s"
timeout = "10s"
path = "/flycheck/pg"
[checks.role]
port = 5500
type = "http"
interval = "15s"
timeout = "10s"
path = "/flycheck/role"
[checks.vm]
port = 5500
type = "http"
interval = "15s"
timeout = "10s"
path = "/flycheck/vm"
[metrics]
port = 9187
path = "/metrics"
I have deployed this new configuration and it shows up in my dashboard.
I can connect on my local dev machine to the Postgres app without having to set up a proxy.
The connection string is something like this:
postgres://postgres:<my postgres password>@<my postgres app name>.fly.dev:5432/<my database name>?schema=public
However, using the exact same connection string (copy/paste) on Vercel leads to an error in my runtime logs:
Can't reach database server at `<my postgres app name>.fly.dev`:`5432`
Please make sure your database server is running at `<my postgres app name>.fly.dev`:`5432`.
at zr.handleRequestError (/var/task/node_modules/.pnpm/@prisma+client@5.0.0_prisma@5.
Any help is appreciated.