URGENT: Beat Service (captivating-encouragement) PostgreSQL Hostname Resolution & Service Reference Issues

tintin2021git
FREE

15 days ago

Hello Railway Team,

I am re-submitting this issue as I have not received a resolution in my previous thread and the problem persists, causing continuous service crashes. My project is captivating-encouragement.

Core Problem: My beat service consistently fails to connect to the PostgreSQL database with the error: django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: Name or service not known.

Current Service Status:

  • web service: Running successfully, connects to PostgreSQL and Redis.

  • worker service: Running successfully, connects to Redis.

  • beat service: CRASHING due to persistent PostgreSQL hostname resolution failure.

Critical Issue Discovered - Railway Service References NOT resolving: When following your previous advice to use Service References (${{Postgres.DATABASE_URL}} and ${{Redis.REDIS_URL}}) in the Railway dashboard environment variables, the literal string$(Postgres.DATABASE_URL) (or similar) was passed into my application's environment. This led to dj_database_url.UnknownSchemeError: Scheme '://' is unknown. This indicates that Railway's Service Reference system is not resolving these variables into actual URLs for my project.

Troubleshooting Steps Taken (All changes pushed to GitHub):

  1. Environment Variables:

    • Initially tried your recommended Service References (${{Postgres.DATABASE_URL}}, ${{Redis.REDIS_URL}}). Failed because they did not resolve into actual URLs.

    • Currently, I have reverted to manually setting the hardcoded internal URLs for DATABASE_URL and REDIS_URL in the Railway dashboard variables for ALL services (web, worker, beat).

      • DATABASE_URL: postgresql://postgres:<redacted>@postgres.railway.internal:5432/railway

      • REDIS_URL: redis://default:<redacted>@redis.railway.internal:6379

    • This enabled web and worker services to connect successfully.

  2. Django settings.py:

    • Updated to use os.environ.get() for DATABASE_URL and REDIS_URL with robust parsing (handling empty strings) as per your general recommendations.

    • Removed debug print statements.

  3. Procfile:

    • Simplified commands as recommended:

      web: python manage.py migrate --noinput && python manage.py collectstatic --noinput && gunicorn kokkai_website.wsgi
      worker: celery -A kokkai_website worker --loglevel=info
      beat: celery -A kokkai_website beat --loglevel=info
      
      
    • Even added sleep 5 to the beat command (beat: sh -c "sleep 5 && celery -A kokkai_website beat --loglevel=info") as a test, but the PostgreSQL hostname resolution error persisted.

Problem persists for beat service: Despite web and worker now running with the direct internal URLs, the beat service continues to fail with the Name or service not known error for postgres.railway.internal. This specific issue for beat suggests a platform-level networking or DNS resolution problem unique to that service's container within my project, given that web can connect to the same PostgreSQL database.

Request: I kindly request an urgent investigation from the Railway engineering team into these two critical issues:

  1. Why are Service References (${{...}}) not resolving into actual URLs in my project's environment variables?

  2. Why does the beat service specifically fail to resolve postgres.railway.internal, even when other services within the same project can, and when direct internal URLs are used?

My project is currently incurring costs without full functionality. Your prompt assistance is greatly appreciated.

Thank you.

Solved$10 Bounty

7 Replies

15 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 15 days ago


Did it start crashing AFTER migration to metal servers?

I recently had a similar issue.


testuser123

Did it start crashing AFTER migration to metal servers?I recently had a similar issue.

tintin2021git
FREE

15 days ago

  • Thank you for your response!
    
    I'm not entirely sure when my project was migrated to metal servers. I created this project and deployed it for the first time around June 17-18, 2025. So, if the migration to metal servers was happening around that time or recently, then yes, it likely started crashing after or during that period.
    
    Could you please share how you resolved your similar issue? Any insights would be greatly appreciated.
    

tintin2021git

Thank you for your response! I'm not entirely sure when my project was migrated to metal servers. I created this project and deployed it for the first time around June 17-18, 2025. So, if the migration to metal servers was happening around that time or recently, then yes, it likely started crashing after or during that period. Could you please share how you resolved your similar issue? Any insights would be greatly appreciated.

sim
FREETop 1% Contributor

13 days ago


sim
FREETop 1% Contributor

13 days ago

I have not tried this myself but there is a way to rollback here https://docs.railway.com/railway-metal#rollback


sim

I have not tried this myself but there is a way to rollback here https://docs.railway.com/railway-metal#rollback

tintin2021git
FREE

13 days ago

"Thank you so much for the detailed information and the link regarding the Railway Metal migration and rollback! It's very helpful to understand the cause of the issues I was facing. I really appreciate you taking the time to share your insights."


sim
FREETop 1% Contributor

13 days ago

Thank you very much If my answer ends up solving your issue, please accept it


sim

Thank you very much If my answer ends up solving your issue, please accept it

tintin2021git
FREE

13 days ago

"Thank you again for the additional information and the link regarding the rollback. It was indeed very helpful in understanding the issues I encountered with my project on Railway.

Although your insights clarified the situation, I've decided to explore other platforms for now to get my project deployed. I appreciate your prompt and helpful responses!"


Status changed to Solved chandrika 12 days ago


URGENT: Beat Service (captivating-encouragement) PostgreSQL Hostname Resolution & Service Reference Issues - Railway Help Station