non-existing domain - :nxdomain

Hi again,

I have one app all up and running now pointing at a postgres application. I’m trying to migrate my other app from an external db to point at the same application but I get the non-existing domain error from postgrex everytime. I’m using the same DATABASE_URL for both applications. Config section below, the if stuff is because I’m migrating from it pointing at an external server that without ipv6 support and is temporary while I try to figure this out. App name has been changed.

fly_db = System.fetch_env!("FLY_DB") || "false"
if fly_db == "true" do
config :my_app, MyApp.Repo,
  log: false,
  ssl: false,
  socket_options: [:inet6],
  adapter: Ecto.Adapters.Postgres,
  url: System.fetch_env!("DATABASE_URL"),
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  timeout: 300_000
else
config :my_app, MyApp.Repo,
  log: false,
  adapter: Ecto.Adapters.Postgres,
  url: System.fetch_env!("DATABASE_URL"),
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  timeout: 300_000
end

This error looks like what I’d expect if the :inet6 option weren’t in play. How are you setting that FLY_DB environment variable? It’s possible we’re stripping out FLY_* env vars to keep them from conflicting with our own.

Will you try that with USE_FLY_DB or something with a different prefix?

Hi kurt,

Thanks for the reply. I tried USE_FLY_DB and the same issue. I even tried removing the whole if block and got the same(then when I switched DATABASE_URL back to the external server I got the same again showing inet6 was setup.

I created a new postgres instance and attached that and same error as well.

I created a new application with the same code and it worked as expected. I have a bunch of domains pointed at the main one so I don’t really want to have to switch. Any ideas?

Can you paste the actual logs / stack trace you’re seeing with :nxdomain?