Managed Postgres connect timeout causing Machines restart loop

Title: Managed Postgres connect timeout causing Machines restart loop

App: vibe-site-sell-backend
Region: ams (but machines appear in fra as well)

Problem:
My app fails to start because Postgres connection times out.
This causes Machines to repeatedly attempt startup, eventually hitting
“machines API rate limit exceeded”.

Errors:

  • server login has been failing, cached error: connect timeout
  • instance refused connection
  • machine still attempting to start
  • machines API returned: rate limit exceeded

What I tried:

  • fly postgres detach / attach
  • ensured DATABASE_URL uses *.internal hostname
  • disabled auto_stop_machines
  • min_machines_running = 1
  • app still fails during startup

Question:
Is this expected behavior when a machine is booting but DB is slow/unreachable?
Any guidance on preventing proxy retry storms or confirming DB reachability
during startup?

Managed Postgres does not use .internal, it uses .flycast, can you confirm it doesn’t work with flycast?

I re-attached database to backend through fly.io dashboard and still getting the same error. I think the problem occurs last Saturday or Sunday. But I didn’t changed anything. Seeing this in the backend logs:
07:01:13[2026-02-09 07:01:13.992] error: server login has been failing, cached error: connect timeout (server_login_retry)

  • 07:01:13error: server login has been failing, cached error: connect timeout (server_login_retry)

  • 07:01:13 at Parser.parseErrorMessage (/opt/node_modules/pg-protocol/dist/parser.js:285:98)

  • 07:01:13 at Parser.handlePacket (/opt/node_modules/pg-protocol/dist/parser.js:122:29)

  • 07:01:13 at Parser.parse (/opt/node_modules/pg-protocol/dist/parser.js:35:38)

  • 07:01:13 at TLSSocket. (/opt/node_modules/pg-protocol/dist/index.js:11:42)

  • 07:01:13 at TLSSocket.emit (node:events:518:28)

  • 07:01:13 at TLSSocket.emit (node:domain:489:12)

  • 07:01:13 at addChunk (node:internal/streams/readable:561:12)

  • 07:01:13 at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)

  • 07:01:13 at Readable.push (node:internal/streams/readable:392:5)

  • 07:01:13 at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)

  • 07:01:13[2026-02-09 07:01:13.993] info: Shutting down Strapi

  • 07:01:14[PC01] instance refused connection. is your app listening on 0.0.0.0:1337? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

Now sawing that this was an incident. Occurred since yesterday, but now it’s working again!

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