6 months 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:
webservice: Running successfully, connects to PostgreSQL and Redis.workerservice: Running successfully, connects to Redis.beatservice: 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):
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_URLandREDIS_URLin the Railway dashboard variables for ALL services (web,worker,beat).DATABASE_URL:postgresql://postgres:<redacted>@postgres.railway.internal:5432/railwayREDIS_URL:redis://default:<redacted>@redis.railway.internal:6379
This enabled
webandworkerservices to connect successfully.
Django
settings.py:Updated to use
os.environ.get()forDATABASE_URLandREDIS_URLwith robust parsing (handling empty strings) as per your general recommendations.Removed debug
printstatements.
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=infoEven added
sleep 5to thebeatcommand (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:
Why are Service References (
${{...}}) not resolving into actual URLs in my project's environment variables?Why does the
beatservice specifically fail to resolvepostgres.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.
7 Replies
6 months 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 • 6 months ago
6 months 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.
6 months 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.
6 months ago
Railway moves the services https://docs.railway.com/railway-metal#gradual-upgrade
6 months 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
6 months 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."
6 months 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
6 months 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 • 6 months ago