Connectivity Issues Between Services in Railway - FastAPI + httpx
alonsodlamilla
HOBBYOP

a year ago

I'm having trouble connecting three microservices deployed on Railway (whatsapp-service, openai-service, and db-service). The services are deployed and working individually, but the whatsapp-service cannot connect to the other two.

Technical Details:

  • All three services are written in FastAPI
  • Using httpx for inter-service calls
  • Current URL configuration in WhatsApp service: DB_SERVICE_DOMAIN=db-service.railway.internal OPENAI_SERVICE_DOMAIN=open-ai-service.railway.internal

Error Logs:

Failed to connect to db service: Cannot connect to host db-service.railway.internal:8000 ssl:default [Connect call failed ('fd12:ed84:1a2b::35:398f:20a9', 8000, 0, 0)]

Failed to connect to openai service: Cannot connect to host open-ai-service.railway.internal:8502 ssl:default [Connect call failed ('fd12:ed84:1a2b::a3:a03a:6dd5', 8502, 0, 0)]

What I've Tried:

  1. Using public URLs (.up.railway.app) - Resulted in 404 errors
  2. Using internal URLs (.railway.internal) - Results in SSL connection errors
  3. Modifying SSL configuration and ports
  4. Verifying all services are in the same Railway project Has anyone encountered similar issues with inter-service communication in Railway? How did you resolve them? PS: Everything worked correctly before when the database was Google Sheets, but after migrating to this microservices architecture, connectivity issues began. Any help would be greatly appreciated!

2 Replies

a year ago

Hello,

The private network is IPv6 only, meaning you need to listen on `::` not 0.0.0.0

More info here -

https://docs.railway.com/guides/private-networking#listen-on-ipv6


IPv4 Private Networks are now available behind a feature flag https://railway.com/account/feature-flags Let us know if you run into any issues


Welcome!

Sign in to your Railway account to join the conversation.

Loading...