Bugfix: Why were Railway backends returning 502 errors despite showi...
Documentation for Sessions
🐛 Bugfix: Why were Railway backends returning 502 errors despite showi...
Date: 2026-01-23
Time: 16:49:18 UTC
Session: editor2-63.9
Agent: backend
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why were Railway backends returning 502 errors despite showing as Online?
Task: Not specified
🎯 Decision Made
Chosen:
Port mismatch: Railway networking configured for ports 3000/3001/3002 but code defaulted to 8080 on Railway
Options Considered:
- No alternatives documented
💭 Reasoning
Railway networking routes traffic to specific ports (backend-api:3000, backend-ai-api:3001, backend-docs-api:3002). The code used process.env.PORT || 8080 on Railway, defaulting to 8080 when PORT wasn't set. This caused connection refused errors because Railway routed to the configured port but the app listened on 8080. Fix: change defaults to match Railway networking config (3000, 3001, 3002).
📁 Files Involved
apis/backend-api/src/main.tsapis/backend-ai-api/src/main.tsapis/backend-docs-api/src/main.ts
🔗 Related
- Decision ID:
dev_1769186958036_8rh5jek - Session: 63
- Workspace: editor2
Auto-generated by MCP Smart Consolidation