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:


💭 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


🔗 Related


Auto-generated by MCP Smart Consolidation