Hi all,
I spent quite a few hours now trying to figure out how to connect a vanilla Phoenix app running on Fly.io to Supabase but I couldn’t make it work on IPV6.
When creating the Fly.io app, a file (/rel/env.sh.eex) gets created with the following configuration:
#!/bin/sh
# configure node for distributed erlang with IPV6 support
export ERL_AFLAGS="-proto_dist inet6_tcp"
export ECTO_IPV6="true"
export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal"
export RELEASE_DISTRIBUTION="name"
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
Then my connection string is configured with a secret in Fly.io:
fly secrets set DATABASE_URL=postgres://...
If I use the default config, then I get the following error connecting with session mode or transaction mode:
17:56:30.334 [error] Postgrex.Protocol (#PID<0.167.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (aws-0-us-east-1.pooler.supabase.com:6543): non-existing domain - :nxdomain
Now, if I comment out the IPV6 config line, it works.
#export ECTO_IPV6="true"
I was wondering if any of you got it working under IPV6. It seems today it is supported by both, Fly.io and Supabase but I can’t figure out how to make it work.
How do you set up your database connection from Fly to Supabase?