I’m having trouble connecting my app to an external database.
2023-05-10T18:13:01.779 app[7811173b532218] mad [info] 18:13:01.779 [error] Postgrex.Protocol (#PID<0.2131.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:01.923 app[784ee71f426238] mad [info] Starting clean up.
2023-05-10T18:13:02.924 app[784ee71f426238] mad [info] [ 423.614968] reboot: Restarting system
2023-05-10T18:13:03.461 app[7811173b532218] mad [info] 18:13:03.461 [error] Postgrex.Protocol (#PID<0.2136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:03.560 app[7811173b532218] mad [info] 18:13:03.559 [error] Postgrex.Protocol (#PID<0.2127.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:04.064 app[7811173b532218] mad [info] 18:13:04.063 [error] Postgrex.Protocol (#PID<0.2130.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:04.870 app[7811173b532218] mad [info] 18:13:04.870 [error] Postgrex.Protocol (#PID<0.2135.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:04.926 app[7811173b532218] mad [info] 18:13:04.926 [error] Postgrex.Protocol (#PID<0.2126.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:07.454 app[7811173b532218] mad [info] 18:13:07.454 [error] Postgrex.Protocol (#PID<0.2133.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:09.454 app[7811173b532218] mad [info] 18:13:09.453 [error] Postgrex.Protocol (#PID<0.2134.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:13.938 app[7811173b532218] mad [info] 18:13:13.938 [error] Postgrex.Protocol (#PID<0.2136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:15.322 app[7811173b532218] mad [info] 18:13:15.322 [error] Postgrex.Protocol (#PID<0.2137.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:15.560 app[7811173b532218] mad [info] 18:13:15.560 [error] Postgrex.Protocol (#PID<0.2131.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:16.354 app[7811173b532218] mad [info] 18:13:16.353 [error] Postgrex.Protocol (#PID<0.2126.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
2023-05-10T18:13:17.080 app[7811173b532218] mad [info] 18:13:17.080 [error] Postgrex.Protocol (#PID<0.2132.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db.fjaspwuyrksfknblcshh.supabase.co:5432): non-existing domain - :nxdomain
...
Until now I had been developing with a db hosted on fly.io deployed and configured through fly launch
, however now I want to deploy to production with my own database and I simply can’t.
I have tried 2 different db providers, however, I can assure you that the problem is not with them, simply because I can access it locally and it also works if I connect locally from the application.
I have the following setup:
My DATABASE_URL
follows the following format:
DATABASE_URL=postgres://user:passwd@hostname:5432/postgres?sslmode=disable
runtime.exs
if System.get_env("PHX_SERVER") do
config :pet, PetWeb.Endpoint, server: true
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :pet, Pet.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
...
Dockerfile
with:
...
# Appended by flyctl
ENV ECTO_IPV6 true
ENV ERL_AFLAGS "-proto_dist inet6_tcp"
Does anyone have any idea what could be going on?