2 months ago
hypercorn.utils.LifespanTimeoutError: Timeout whilst awaiting startup. Your application may not support the ASGI Lifespan protocol correctly, alternatively the startup_timeout configuration is incorrect.
I'm getting this issue in deployment step: see attached log file.
Attachments
1 Replies
2 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 ray-chen • 2 months ago
2 months ago
this is almost a timeout issue. try this,
add --startup-timeout 60 to your hypercorn command and make sure you're binding to railway's port:
bash
hypercorn app:app --bind 0.0.0.0:$PORT --startup-timeout 60if that doesn't work, check if you have any blocking code (like db.connect() or api calls) in your lifespan/startup events - those need to be async (await db.async_connect()) or they'll block forever and timeout.
also make sure your app actually implements the asgi lifespan protocol correctly. if you're using fastapi/quart you're good, but if it's flask or something wrapped, that might be the issue.
most of the time it's just the default 10 second timeout being too short for railway's cold starts. bump it to 60 and you should be fine.