Outbound DNS / HTTPS to api.telegram.org failing — Telegram bot can't set webhook or poll
sa1raz
FREEOP

a month ago

Hello Railway Support team,

I have a service deployed on Railway that runs a Telegram bot (python + telebot + Flask + eventlet). Since deployment, the container cannot resolve or reach api.telegram.org and the bot repeatedly fails to set the webhook or start polling. This prevents the bot from receiving updates.

Observed behavior / logs

  • In my service logs I see repeated DNS / name resolution timeouts and errors such as:

    • socket.gaierror: [Errno -3] Lookup timed out

    • urllib3.exceptions.NameResolutionError: Failed to resolve 'api.telegram.org' ([Errno -3] Lookup timed out)

    • requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded...

  • Example excerpt (please do not request the bot token; token is not included here):

    Code

    socket.gaierror: [Errno -3] Lookup timed out
    urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object>: Failed to resolve 'api.telegram.org' ([Errno -3] Lookup timed out)
    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot<redacted>/getMe (Caused by NameResolutionError(...))
    

What I need from Railway

  1. Please verify whether outbound DNS resolution and HTTPS outbound connections from my container to api.telegram.org (port 443) are allowed in the environment where my service runs.

  2. If there are egress restrictions or network policies preventing outbound DNS or HTTPS, please advise how to permit outbound traffic to api.telegram.org (or add an exception/whitelist) for my project.

  3. If additional networking configuration is required on my side (for example, enabling NAT/Egress gateway or configuring a custom DNS resolver), please provide step-by-step guidance specific to Railway.

  4. If you see platform-side DNS resolver problems affecting containers, please let me know expected ETA for resolution or a recommended workaround.

Relevant details I can provide

  • Project name / service name: (I can paste it here if needed)

  • Deployment ID / region / container ID: (I can provide these on request or attach logs)

  • Example log timestamps: (I can attach a full log file on request)

  • I am willing to enable temporary environment flags (e.g., BOT_DISABLE_BOT=true or EVENTLET_NO_GREENDNS=true) if you recommend that as a workaround.

Why this matters

  • Telebot libraries attempt to call api.telegram.org both for webhook setup and for getMe when polling. If DNS or HTTPS is blocked, the bot cannot operate (no incoming updates). The issue appears to be network/DNS access from the container to api.telegram.org.

Temporary workarounds I attempted

  • Considered running polling instead of webhook, but polling also needs to reach api.telegram.org; it still fails when DNS resolution is blocked.

  • Setting env EVENTLET_NO_GREENDNS=true is a potential workaround (it forces system resolver), but I need confirmation whether Railway's environment allows outbound DNS at all.

Please let me know:

  • Is there a known outage or policy affecting outbound DNS/HTTPS from my container?

  • If you can whitelist or enable egress for api.telegram.org for my project, what information do you need from me (project name, deployment id)?

  • Recommended temporary fixes while the platform DNS issue is investigated.

Thank you — I can provide any deployment identifiers or full logs you need.

Solved$10 Bounty

3 Replies

Railway
BOT

a month 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: - [🧵 failed to connect to facebook graph api](https://station.railway.com/questions/failed-to-connect-to-facebook-graph-api-ed4ade1f) - [🧵 Urgent: Production Service DNS Resolution Failure (NameResolutionError) - Timeline and Analysis](https://station.railway.com/questions/urgent-production-service-dns-resolutio-8e7f6df8) - [🧵 Technical Issue](https://station.railway.com/questions/technical-issue-b1a7b0ee) If you find the answer from one of these, please let us know by solving the thread!

sa1raz
FREEOP

a month ago

no


Status changed to Awaiting Conductor Response noahd 25 days ago


Uh oh.

Can you try migrating your service to a different region and trying again?


Status changed to Awaiting User Response Railway 25 days ago


Railway
BOT

18 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 18 days ago


Loading...