3 months ago
I’ve deployed a Telegram bot using Python (aiogram + aiohttp) on the $5 Hobby plan. The build succeeds, the server starts, and the webhook is set correctly. However, the bot shuts down immediately after startup every time (after ~5–10 seconds).
Here are the logs:
2025-09-17 11:28:21,840 [INFO] moviebot: Starting server on port 8080
2025-09-17 11:28:21,841 [INFO] moviebot: Initializing DB...
2025-09-17 11:28:21,852 [INFO] moviebot: Setting webhook...
2025-09-17 11:28:21,878 [INFO] moviebot: Webhook set to https://moviebot-production-627a.up.railway.app/webhook
2025-09-17 11:28:23,970 [WARNING] moviebot: Shutting down...
This pattern repeats on every restart: the bot sets the webhook successfully, then Railway immediately shuts down the app.
Environment details:
Python app with aiogram==3.x and aiohttp==3.x
Running with a Procfile:
web: python main.py
The app listens on 0.0.0.0:$PORT (default is 8080).
Works locally without issues (bot responds to updates).
GitHub repo link (if helpful): [your repo link here]
What I’ve tried:
Verified PORT is set correctly (8080).
Confirmed webhook is set successfully by Telegram.
Removed deprecated bot.close() (no effect).
Tested on Render → same issue (shuts down right after startup).
It seems the process is being terminated by Railway rather than by the app itself. Could you help me understand why the container is shutting down right after startup?
Thanks in advance!
3 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
Railway
Hey there! We've found the following might help you get unblocked faster: - [🧵 Mysql crashed Cannot downgrade from 90001 to 80402](https://station.railway.com/questions/mysql-crashed-cannot-downgrade-from-9000-38a38b23) - [🧵 Container stops right after starting (Hobby Plan)](https://station.railway.com/questions/container-stops-right-after-starting-ho-f2623f9f) - [🧵 SIGTERM on App Start with Elixir/Nostrum](https://station.railway.com/questions/sigterm-on-app-start-with-elixir-nostrum-d38b216b) - [🧵 Container starts and stops 3 seconds later](https://station.railway.com/questions/container-starts-and-stops-3-seconds-lat-60ab4b63) If you find the answer from one of these, please let us know by solving the thread!
3 months ago
I think non of them is related
3 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 • 3 months ago
2 months ago
Hey there!
This might be a stupid question, but could this be that your scripts entire lifecycle is "spawn, set up DB, send webhook, exit"?
Is it meant to be set up as a webhook server for inbound requests or simply to ping something else?
Would love any more info that I can get on the project itself. All info is good info!