Issues Connecting Render to Supabase After IPv6 Transition

Hi everyone,

I’m having trouble connecting my Render service to my Supabase database after Supabase transitioned to IPv6. Here are the details:

This is the connection string I get from the database’s settings’s dashboard.

postgresql://postgres.wcxubtyxbzghxkawszdq:[password]@aws-0-eu-central-1.pooler.supabase.com:5432/postgres

I understand that Render does not currently support IPv6, and I understand that Supabase has moved to IPv6. As a result, my service cannot connect to the Supabase database, I’m able to connect on local host however.

Is there a solution? apparently if I buy the Pro plan on supabase, I get an IPv4 connection string, but since my use is not commercial, I don’t see that as a practicial solution.

Thank you in advance.

Hi there,

Thanks for getting in touch.

The error you are seeing is related to the recent change that Supabase made regarding their switch to IPv6 from IPv4. The change to direct database connections came into effect for all their customers on 1st Feb 2024.

https://supabase.com/blog/ipv6
https://github.com/orgs/supabase/discussions/17817

Render does not currently support IPv6, so you’ll need to update your Superbase connection details on your Render service to be able to connect. You have two options:

  1. In your Supabase dashboard, go to the database settings page and use the details provided in the “Connection String” panel - this is an IPv4 service and will allow your Render service to communicate with Supabase.

  2. If you still want to connect directly to your Supabase database and you’re using a paid Supabase plan you can enable their IPv4 addon at a cost.

When you’ve made the change ensure that a new deployment occurs - if you have auto deployment disabled then you will need to perform a manual deploy via the button in the dashboard for the change to take effect.

If you have Supabase specific questions, please ask Supabase directly, via https://github.com/orgs/supabase/discussions/17817

Regards,

I am confused.

The URL aws-0-eu-central-1.pooler.supabase.com:5432/postgres uses the pooler, which resolves to IPv4. Why would the lack of IPv6 support be a problem here?

Hi, Thank you.

When you refrence the supabase dashboard, are you referring to the connection string I get? if yes, then I’m already using the string but the error persisits, this is how the error looks like:

Error: connect ECONNREFUSED 127.0.0.1:5432
    at createConnectionError (node:net:1634:14)
    at afterConnectMultiple (node:net:1664:40) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432
}

]
}

I used chatGPT to understand the error further, and this is what I got back:
“”"
The error you’re encountering (ECONNREFUSED ::1:5432) suggests that your application is unable to connect to the PostgreSQL database. The specific issue is that the application is trying to connect to the database at the address ::1 (which is the IPv6 loopback address equivalent to 127.0.0.1 in IPv4), but the connection is refused.
“”"

On the dashbaord connection string, it mentions that it resolves to IPv4, but the error persists.

No idea why, but this the error I get:

   Error: connect ECONNREFUSED 127.0.0.1:5432
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 5432
    }
  ]
}

I used chatGPT to understand the error further, and this is what I got:

The error you’re encountering (ECONNREFUSED ::1:5432) suggests that your application is unable to connect to the PostgreSQL database. The specific issue is that the application is trying to connect to the database at the address ::1 (which is the IPv6 loopback address equivalent to 127.0.0.1 in IPv4), but the connection is refused.

Exactly that.

If you’re seeing 127.0.0.1 then that means your application is not using the correct details and is defaulting to use the localhost address which will fail.

You will need to investigate if you are passing the correct configuration in your application code itself,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.