Database connection error deploying phoenix app to fly.io

Hi,
I’m trying to deploy a phoenix app to fly io. Everything build correctly and all my migrations work locally.
But if I do fly deploy, the process crashes because no connection to the db can be established:

  11:54:07.338 [error] Postgrex.Protocol (#PID<0.167.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (link-shortener-1405.j77.cockroachlabs.cloud:26257): non-existing domain - :nxdomain
  11:54:07.338 [error] Postgrex.Protocol (#PID<0.166.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (....cockroachlabs.cloud:26257): non-existing domain - :nxdomain
  11:54:08.998 [error] Postgrex.Protocol (#PID<0.166.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (....cockroachlabs.cloud:26257): non-existing domain - :nxdomain
  11:54:09.246 [error] Could not create schema migrations table. This error usually happens due to the following:
    * The database does not exist
    * The "schema_migrations" table, which Ecto uses for managing
      migrations, was defined by another library
    * There is a deadlock while migrating (such as using concurrent
      indexes with a migration_lock)
  To fix the first issue, run "mix ecto.create" for the desired MIX_ENV.
  To address the second, you can run "mix ecto.drop" followed by
  "mix ecto.create", both for the desired MIX_ENV. Alternatively you may
  configure Ecto to use another table and/or repository for managing
  migrations:
      config :link_shortener, LinkShortener.Repo,
        migration_source: "some_other_table_for_schema_migrations",
        migration_repo: AnotherRepoForSchemaMigrations
  The full error report is shown below.
  ** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2984ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:
    1. Ensuring your database is available and that you can connect to it
    2. Tracking down slow queries and making sure they are running fast enough
    3. Increasing the pool_size (although this increases resource consumption)
    4. Allowing requests to wait longer by increasing :queue_target and :queue_interval
  See DBConnection.start_link/2 for more information
      (ecto_sql 3.11.1) lib/ecto/adapters/sql.ex:1054: Ecto.Adapters.SQL.raise_sql_call_error/1
      (elixir 1.15.7) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
      (ecto_sql 3.11.1) lib/ecto/adapters/sql.ex:1161: Ecto.Adapters.SQL.execute_ddl/4
      (ecto_sql 3.11.1) lib/ecto/migrator.ex:755: Ecto.Migrator.verbose_schema_migration/3
      (ecto_sql 3.11.1) lib/ecto/migrator.ex:563: Ecto.Migrator.lock_for_migrations/4
      (ecto_sql 3.11.1) lib/ecto/migrator.ex:432: Ecto.Migrator.run/4
      (ecto_sql 3.11.1) lib/ecto/migrator.ex:170: Ecto.Migrator.with_repo/3
      nofile:1: (file)

As you might see the db is hosted on cockroachdb and is available an empty.
I also had the same issue connecting to a selfhosted postgres instance.
What I don’t quite understand is the error non-existing domain - :nxdomain.

I already tried to set:

socket_options: [:inet6]

But this didn’t help.

Does anyone have an idea how to fix this?
Thank you in advance.