a month ago
My FastAPI backend fails to start because PostgreSQL cannot be reached using the internal Railway hostname.
The application repeatedly crashes during startup with the following error:
psycopg2.OperationalError:
could not translate host name "Postgres-test.railway.internal"
to address: Name or service not known
This happens during application startup when SQLAlchemy attempts to open a database connection.
The backend and the PostgreSQL service are in the same Railway project, but the internal hostname (*.railway.internal) is not resolving inside the backend container. As a result, Gunicorn keeps restarting and the service never becomes healthy.
Using the public DATABASE_URL works correctly, but the internal hostname appears to be broken or unavailable in this environment.
Additional info
Backend: FastAPI + SQLAlchemy + psycopg2
Runtime: Python 3.11
1 Replies
a month ago
Hey there!
We had a short period of time where private network names got created with a capital letter. I went ahead and sorted that for you. Can you try correcting it to the lowercase variant and let me know if it works? Thanks!
Status changed to Awaiting User Response Railway • about 1 month ago
23 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 23 days ago