this is what my Emergent says

liverichtravel
PRO

13 days ago

THE ROOT PROBLEM IS RAILWAY BACKEND - IT'S COMPLETELY BROKEN

Current Status:

  • Frontend works perfectly (calls correct URL)

  • CORS error is actually a GOOD sign (means frontend is trying to connect)

  • Railway backend returns 502 "Application failed to respond"

  • Railway shows "deployed successfully" but doesn't actually work

THE REAL ISSUE:

Railway backend is completely non-functional. It's not a CORS issue - it's that Railway isn't serving any content at all.

You have 3 choices:

  1. Fix Railway (requires MongoDB Atlas connection string update)

  2. Deploy to different platform (Heroku, Render, DigitalOcean)

  3. Use working local backend temporarily while fixing Railway

Your staff can't use it because Railway backend is 100% broken, not because of frontend issues.

What do you want to do - fix Railway or deploy elsewhere?

it's been days now

$10 Bounty

4 Replies

Railway
BOT

13 days 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!


liverichtravel
PRO

13 days ago

COMPLETE PROBLEM EXPLANATION FOR RAILWAY SUPPORT

THE FULL ISSUE:

Project: LiveRich Video Organizer (Python FastAPI + React Frontend)
Problem: Railway backend deployment shows "successful" but returns 502 errors for ALL endpoints Duration: 9+ days of troubleshooting Impact: Production app completely non-functional, staff cannot use application

DETAILED TECHNICAL STATUS:

WORKING COMPONENTS:

  • Frontend (Vercel): Deployed successfully, calls correct Railway URL

  • Local Development: Backend runs perfectly on localhost with full functionality

  • MongoDB Atlas: Database created and connection string available

  • Google OAuth: Credentials configured and working locally

BROKEN COMPONENT:

  • Railway Backend: Shows "deployed successfully" but completely non-responsive

SPECIFIC ERROR PATTERN:

Every API endpoint returns identical error:

curl https://liverichvideoorganizer-production.up.railway.app/api/system/health
# Response: {"status":"error","code":502,"message":"Application failed to respond"}

curl https://liverichvideoorganizer-production.up.railway.app/health  
# Response: {"status":"error","code":502,"message":"Application failed to respond"}

curl https://liverichvideoorganizer-production.up.railway.app/
# Response: {"status":"error","code":502,"message":"Application failed to respond"}

📋 RAILWAY DEPLOYMENT DETAILS:

  • Repository: GitHub integration, auto-deploy from main branch

  • Build: Dockerfile-based, builds successfully (no errors)

  • Health Check: Shows as passing in Railway dashboard

  • Logs: Show "Uvicorn running on http://0.0.0.0:8080" but external requests fail

  • Start Command: sh -c "cd backend && python -m uvicorn server:app --host 0.0.0.0 --port ${PORT:-8000}"

CORE ISSUE:

Railway's internal container appears to start successfully, but the external gateway/proxy cannot communicate with the container, resulting in 502 "Application failed to respond" for all requests.

SUSPECTED ROOT CAUSES:

  1. Port binding mismatch between container and Railway gateway

  2. Health check configuration not aligned with actual application endpoints

  3. Environment variable issues preventing proper startup

  4. Railway infrastructure issue with proxy/load balancer

Request: Need Railway engineering team to investigate why external gateway cannot reach successfully deployed container.


idiegea21
HOBBYTop 10% Contributor

13 days ago

In your Railway project’s environment variables, ensure PORT is NOT manually set. Railway sets it automatically. Manually setting it may cause conflicts like this.

python -m uvicorn server:app --host 0.0.0.0 --port ${PORT:-8000}

so,technically the above is fine as long as the env var PORT is actually set by Railway.

Also,Check Your FastAPI App Path and make sure that server.py exists in the expected location. and Confirm it contain:

from fastapi import FastAPI
app = FastAPI()

idiegea21
HOBBYTop 10% Contributor

13 days ago

you could also confiem that Railway is injecting the correct port at runtime. by logging the port

import os
print("Starting FastAPI on port:", os.environ.get("PORT"))