Skip to content
UDP not working for my discord bot
davidmatloch
OP

9 days ago

Title: Outbound UDP to Discord voice servers never completes (stuck at UDP handshake)

Hi Railway team,

My Discord bot runs on Railway and its voice connections never become ready. The bot connects to Discord's gateway fine and joins the voice channel, but the audio connection stalls at the UDP handshake step and times out after 20 seconds.

Setup:

  • Region: EU West, 1 replica
  • Node 22.23.4
  • discord.js 14.26.4 with @discordjs/voice 0.19.2
  • Bot has Administrator permission in the server, so this is not a permissions problem

Logs (guild ID replaced with X):

[voice X] signalling -> connecting

[voice X] networking step: OpeningWs

[voice X] networking: OpeningWs -> Identifying

[voice X] networking: Identifying -> UdpHandshaking

[voice X] never reached Ready (stuck in "connecting"): The operation was aborted

[voice X] networking: UdpHandshaking -> Closed

[voice X] networking error: Cannot perform IP discovery - socket closed

So the voice websocket works (OpeningWs, Identifying), but the IP-discovery UDP packet to Discord's voice server never gets a reply.

Questions:

  1. Is outbound UDP from services to external hosts currently allowed on Railway, including to Discord's voice servers (random high UDP ports)?
  2. If there is a restriction or a recent network change, is there a setting or workaround to allow it?
  3. Is this related to the existing report here: https://station.railway.com/questions/discord-voice-udp-connections-failing-502e2d88

The same code and library work on other hosts. Please let me know if you need the project or service ID, which I can provide.

Thanks!

Solved

3 Replies

Railway
BOT

9 days ago

The only outbound UDP limitation we have is with Static Outbound IPs: outbound UDP isn't supported when a service uses that feature. Outside of that, there isn't a setting that switches outbound UDP on or off for a service.

If Static Outbound IPs is enabled on this bot's service, that would explain the IP discovery packet never getting a reply, since that combination isn't supported. The report you linked is about another service, so we can't use it to explain what's happening with yours.

To check your service, please link it to this thread and share the UTC time of a recent voice connection attempt that failed. Linking a service doesn't make any of its details public.


Status changed to Awaiting User Response Railway • 9 days ago


davidmatloch
OP

9 days ago

Thanks for the quick reply. I've checked the service:

  • Static Outbound IPs is NOT enabled. It shows as a Pro-plan feature, and the service only lists the default Shared outbound IPs.
  • Outbound IPv6 was off. I tried turning it on and the result was the same (REPLACE: same result / not tried yet).

I've linked the service to this thread.

Failed voice connection attempt: about 00:13 UTC on 11 November 2026.

What the logs show (guild ID removed):

[voice X] signalling -> connecting

[voice X] networking: OpeningWs -> Identifying

[voice X] networking: Identifying -> UdpHandshaking

[voice X] never reached Ready (stuck in "connecting"): The operation was aborted

So the voice websocket connects, but the UDP IP-discovery packet never gets a reply, and it times out after 20 seconds. Node 22.23.4, EU West, 1 replica.

Could you check from your side:

  1. Whether outbound UDP from this service to Discord's voice servers is being dropped or not returning replies (for example on the shared egress IPs or in the EU West region)?
  2. Whether there is anything else on this service that would affect outbound UDP replies?
  3. Whether moving the service to a different region could help, and if so how I should do that?

Thanks!


Status changed to Awaiting Railway Response Railway • 9 days ago


Railway
BOT

9 days ago

We checked your service's network activity around your latest attempt at 00:29 UTC. Your bot's UDP IP-discovery packet did leave the container for Discord's voice server, then went out again every 5 seconds, and no reply came back in that window. Nothing on our side recorded dropping those packets. We also confirmed that Static Outbound IPs isn't enabled on this service, so that limitation doesn't apply. From the data we can read, we can't tell where along the path the reply was lost.

There's no service setting that turns outbound UDP on or off, and nothing else in this service's configuration is specific to UDP.

You can change the region from the Regions field in the service settings. This service has no volume attached, so the change doesn't affect your domains and doesn't cause downtime (Regions). We haven't confirmed whether a different region would change the result for Discord voice.


Status changed to Awaiting User Response Railway • 9 days ago


Railway
BOT

2 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 • 1 day ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...