DNS resolution issue with Supabase from Railway - ENOTFOUND
kawaiiagency
HOBBYOP

18 days ago

Hello,

I'm experiencing a connectivity issue between my Next.js application deployed on Railway and an external PostgreSQL database hosted on Supabase.

The Problem:

When my application tries to query the database from Railway, it fails with this error:

Error: getaddrinfo ENOTFOUND [project-id].supabase.co

TypeError: fetch failed

The error indicates that Railway cannot resolve the DNS for our Supabase instance.

Details:

  • Application: Next.js 15.5.15 on Railway
  • Database: Supabase (external PostgreSQL)
  • Environment: Production
  • The same code works perfectly on localhost and other hosting providers

What we've tried:

  1. Verified that environment variables are correctly set on Railway
  2. Confirmed the database is online and accessible from other networks
  3. Checked that no firewall rules are blocking the connection
  4. Tested with direct fetch requests to the database REST API

Question:

Does Railway have any firewall restrictions that would block external database connections to Supabase? Is there a way to whitelist or allow these connections?

Thank you

Solved$10 Bounty

2 Replies

Status changed to Open Railway 18 days ago


Have you tried enabling IPv6 outbound networking in your service settings? Make sure to redeploy after.


Status changed to Awaiting User Response Railway 17 days ago


kawaiiagency
HOBBYOP

17 days ago

Thank you for the suggestion!

We've enabled IPv6 outbound networking in our Railway service settings and redeployed the application as you recommended. However, the issue persists.

We're still getting the same error:

Error: getaddrinfo ENOTFOUND xxxxxxxxxxxx.supabase.co

TypeError: fetch failed

Even with IPv6 enabled, Railway cannot resolve the DNS for our Supabase instance. The same application works perfectly on localhost and other hosting providers, so the issue seems specific to Railway's network connectivity with Supabase.

Additional details:

  • All environment variables are correctly set (NEXT_PUBLIC_SUPABASE_URL, API keys, etc.)
  • We can reach other external services
  • The error occurs both for direct fetch requests and through the Supabase SDK

Could this be a more fundamental network restriction on Railway that blocks connections to Supabase? Are there any other settings we should check, or is this a known issue between Railway and Supabase?

Thank you for any additional guidance!


Status changed to Awaiting Railway Response Railway 17 days ago


Status changed to Solved kawaiiagency 17 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...