a year ago
Project: 4b640aaa-c1cf-41f3-8d70-c353abfa1bc2
Building a collaborative editor (NextJS + Lexical + y-redis) on Railway. WebSocket connections fail with code 1006 in production but work perfectly locally.
The Problem
- β Auth works - HTTP 200
- β WebSocket upgrade completes
- β Connection opens
- β Immediately closes with 1006 when server sends initial Yjs sync messages
Error Details
π WebSocket connection opened for user: {...}
π€ Sending SyncStep1...
β WebSocket connection closed: { code: 1006, reason: 'abnormal closure' }
HTTP: 499 "client closed request before server response"Railway Context
Confirmed Railway WebSocket bug reported June 20th with identical symptoms. Railway claimed it was fixed, but still experiencing it.
What I've Tried
- β
Disabled compression (
uws.DISABLED) - β Reduced timeout to 30s
- β Added delays before sync messages
- β Still fails when sending binary Yjs data
My Theory
Railway's proxy has issues with binary Yjs protocol messages. Connection opens fine, but terminates when sending sync data.
Questions
- Anyone else having Railway WebSocket issues?
- Alternative hosting for WebSocket-heavy apps?
- Tried both US West/East region, region issue?
- Disabled RailwayMetal Edge, maybe thats the problem?
// Works locally, fails on Railway
app.ws('/:room', {
compression: uws.DISABLED,
idleTimeout: 30,
// ...sends binary Yjs sync messages
})Blocked for 3+ days on this! Any help appreciated π
#websockets #yjs #lexical
1 Replies
a year ago
according to my brief research your theory is correct, i had similar issues with processes been terminated abruptly, with sidekiq, a background job gem, in rails so i moved my code to fly.io and kept the databases, postgres and redis here.