Postgrex can't connect during release_command (NXDOMAIN for internal DB)

:red_question_mark: Postgrex can’t connect during Fly.io release_command (NXDOMAIN for internal DB)

Hi everyone, I’m deploying a Phoenix app to Fly.io and I’m running into this error when the release_command tries to run /app/bin/migrate.

The database is created successfully using fly postgres create and fly postgres attach, and the app is configured with the correct DATABASE_URL pointing to startkit-db.internal:5432.

However, during deploy I consistently get:

** (DBConnection.ConnectionError) tcp connect (startkit-db.internal:5432): non-existing domain - :nxdomain

This causes the release to fail with:

Could not create schema migrations table...

I confirmed that:

  • The database is running
  • I can connect manually using fly proxy + psql
  • The database name and credentials are correct

But Fly’s release machine seems to not be resolving startkit-db.internal.

Is there a delay before *.internal or *.flycast DNS entries become resolvable in the Fly network?
Is there a recommended way to ensure the release machine sees the database immediately after creation?

Thanks in advance for any help!


Hi… Usually this is due to the need to opt-in to IPv6 within the Elixir plumbing, :dragon:. It would probably also be prudent to take a peek at your *.Repo configuration and see what it has in the way of socket_options, etc.

(You need IPv6 on and SSL off, for Legacy Postgres.)

Hope this helps a little!