Postgres attach: lookup i/o timeout

Hi,

I’m trying to develop a Remix application (with Postgres) but I run into errors.

➜  horeka main ✓ fly create horeka
automatically selected personal organization
New app created: horeka

➜  horeka main ✓ fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app horeka
Secrets are staged for the first deployment

➜  horeka main ✓ fly postgres create --name horeka-db
Automatically selected personal organization
? Select region: fra (Frankfurt, Germany)
For pricing information visit: https://fly.io/docs/about/pricing/#postgresql-clusters
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster horeka-db in organization personal
Postgres cluster horeka-db created
  Username:    postgres
  Password:    ****
  Hostname:    horeka-db.internal
  Proxy Port:  5432
  PG Port: 5433
Save your credentials in a secure place, you won't be able to see them again!

Monitoring Deployment

1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 3 total, 3 passing]
--> v0 deployed successfully

Connect to postgres
Any app within the personal organization can connect to postgres using the above credentials and the hostname "horeka-db.internal."
For example: postgres://postgres:****@horeka-db.internal:5432

See the postgres docs for more information on next steps, managing postgres, connecting from outside fly:  https://fly.io/docs/reference/postgres/

➜  horeka main ✓ fly postgres attach --postgres-app horeka-db --app horeka
Error Get "http://horeka-db.internal:5500/commands/databases/horeka": dial: lookup horeka-db.internal. on fdaa:0:4d22::3: read udp [fdaa:0:4d22:a7b:163a:0:a:0]:52017: i/o timeout

➜  horeka main ✓ flyctl ssh console -s                                                                                                                                             
Connecting to tunnel ⣯ Error tunnel unavailable: failed probing "personal": context deadline exceeded

➜  horeka main ✓ fly doctor
Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... Nope
Pinging WireGuard gateway (give us a sec)... FAILED
(Error: ping gateway: no response from gateway received)

We can't establish connectivity with WireGuard for your personal organization.

WireGuard runs on 51820/udp, which your local network may block.

If this is the first time you've ever used 'flyctl' on this machine, you
can try running 'flyctl doctor' again.

➜  horeka main ✓ flyctl dig txt _apps.internal
Error connect tcp [fdaa:0:4d22::3]:53: operation timed out

➜  horeka main ✓ flyctl -a horeka dig txt _apps.internal
Error connect tcp [fdaa:0:4d22::3]:53: operation timed out

Note that in the past, I already succeeded to setup a similar app with Postgres without any issues.

Any help would be greatly appreciated :pray:

Digging into the forum, I found some suggestions from @kurt and tried to reset my wireguard config:

➜  horeka main ✓ flyctl wireguard reset
Automatically selected personal organization
New WireGuard peer for organization 'personal': 'xxxx'

➜  horeka main ✓ flyctl -a horeka dig txt _apps.internal
;; opcode: QUERY, status: NOERROR, id: 50091
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;_apps.internal.        IN       TXT

;; ANSWER SECTION:
_apps.internal. 5       IN      TXT     "horeka-db"

➜  horeka main ✓ fly postgres attach --postgres-app horeka-db --app horeka

Postgres cluster horeka-db is now attached to horeka
The following secret was added to horeka:
  DATABASE_URL=xxx

It seems resetting wireguard was the right move. Not sure what happened. Would love to get more info on that one.

I hope it can help someone in the future :slight_smile:

2 Likes