I am getting 502 error but logs does not show any error
prsharma21
HOBBYOP

3 months ago

I am getting 502 error but logs does not show any error

my project has two applications frontend and backend. backend connected to postgres

You reached the start of the range

Dec 20, 2025, 4:15 PM

Starting Container

[2025-12-20 10:45:49] [INFO] Frontend URL: https://instagram-reel-automation-production.up.railway.app/

[2025-12-20 10:45:49] [INFO] Python version: 3.11.14 (main, Dec 8 2025, 23:39:47) [GCC 14.2.0]

[2025-12-20 10:45:49] [INFO] ============================================================

Uvicorn will run in foreground to keep container alive...

DATABASE_URL: SET

FRONTEND_URL: https://instagram-reel-automation-production.up.railway.app/

=========================================

[2025-12-20 10:45:49] [INFO] ============================================================

[2025-12-20 10:45:49] [INFO] Environment: production

✓ Frontend static files found

[2025-12-20 10:45:49] [INFO] Production mode: True

[2025-12-20 10:45:49] [INFO] Starting InstaReel Backend Application

total 16

drwxr-xr-x 3 root root 4096 Dec 20 10:03 .

drwxr-xr-x 1 root root 4096 Dec 20 10:36 ..

drwxr-xr-x 2 root root 4096 Dec 20 10:03 assets

-rw-r--r-- 1 root root 760 Dec 20 10:03 index.html

=========================================

Starting uvicorn server...

Starting InstaReel Backend API

=========================================

PORT: 8080

[2025-12-20 10:45:49] [INFO] Working directory: /app

[2025-12-20 10:45:49] [INFO] Script location: /app

[INFO] CORS configured for: https://instagram-reel-automation-production.up.railway.app/ (Production mode)

[2025-12-20 10:45:49] [INFO] [STATIC] Setting up static file serving...

[2025-12-20 10:45:49] [INFO] [STATIC] Checking for static directory at: /app/static

[2025-12-20 10:45:49] [INFO] [STATIC] Static directory exists: True

[2025-12-20 10:45:49] [INFO] [STATIC] Absolute path: /app/static

[2025-12-20 10:45:49] [INFO] [STATIC] Static directory contents: ['assets', 'index.html']

[2025-12-20 10:45:49] [INFO] [STATIC] index.html exists: True

[2025-12-20 10:45:49] [INFO] [STATIC] index.html size: 760 bytes

[2025-12-20 10:45:49] [INFO] [STATIC] assets directory exists: True

[2025-12-20 10:45:49] [INFO] [STATIC] assets directory contents (first 5): ['index-iEBHyi04.css', 'index-DxIkU1mk.js']

[2025-12-20 10:45:49] [INFO] [STATIC] ✓ Mounted /assets from /app/static/assets

INFO: Started server process [1]

INFO: Waiting for application startup.

[2025-12-20 10:45:49] [INFO] ============================================================

[2025-12-20 10:45:49] [INFO] [STARTUP] Initializing application...

[2025-12-20 10:45:49] [INFO] ============================================================

[2025-12-20 10:45:49] [INFO] [STARTUP] Environment check:

[2025-12-20 10:45:49] [INFO] - ENVIRONMENT: production

[2025-12-20 10:45:49] [INFO] - FRONTEND_URL: https://instagram-reel-automation-production.up.railway.app/

[2025-12-20 10:45:49] [INFO] - DATABASE_URL: SET

[2025-12-20 10:45:49] [INFO] - PORT: 8080

[2025-12-20 10:45:49] [INFO] [STARTUP] Waiting 2 seconds for services to be ready...

[2025-12-20 10:45:51] [INFO] [STARTUP] Database initialization attempt 1/3...

[2025-12-20 10:45:51] [INFO] [DB INIT] Starting database initialization...

[2025-12-20 10:45:51] [INFO] [DB] Connecting to: trolley.proxy.rlwy.net:14945

[2025-12-20 10:45:51] [INFO] [DB] ✓ Connection established successfully

[2025-12-20 10:45:51] [INFO] [DB INIT] ✓ Database tables initialized successfully

[2025-12-20 10:45:51] [INFO] [STARTUP] ✓ Database initialized successfully

[2025-12-20 10:45:51] [INFO] ============================================================

[2025-12-20 10:45:51] [INFO] [STARTUP] ✓ Application started in production mode

[2025-12-20 10:45:51] [INFO] [STARTUP] ✓ Frontend URL: https://instagram-reel-automation-production.up.railway.app/

[2025-12-20 10:45:51] [INFO] [STARTUP] ✓ All systems ready

[2025-12-20 10:45:51] [INFO] ============================================================

INFO: Application startup complete.

INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

[2025-12-20 10:45:52] [INFO] [HEALTH] Health check requested

[2025-12-20 10:45:52] [INFO] [DB] Connecting to: trolley.proxy.rlwy.net:14945

[2025-12-20 10:45:52] [INFO] [DB] ✓ Connection established successfully

[2025-12-20 10:45:52] [INFO] [HEALTH] Database: connected

[2025-12-20 10:45:52] [INFO] [HEALTH] Static files: found, index.html: found

[2025-12-20 10:45:52] [INFO] [HEALTH] Returning response: {'status': 'ok', 'service': 'InstaReel Backend API', 'environment': 'production', 'database': 'connected', 'static_files': 'found', 'index_html': 'found', 'version': '1.0.0'}

INFO: 100.64.0.2:48361 - "GET /api/health HTTP/1.1" 200 OK

$10 Bounty

2 Replies

3 months ago

You need to configure the www subdomain as well. www.instagram-reel-automation-production.up.railway.app and instagram-reel-automation-production.up.railway.app are separate domains. Right now, only the non-www domain is working.

check if this is the issue


shakirali78690
FREE

3 months ago

Your backend is up and answering /api/health with 200, so the 502 is coming from the edge proxy, not from Uvicorn itself. Double‑check that the service’s public HTTP port in Settings → Networking is 8080, and that your domain/frontend is calling that service/domain directly. Also try hitting /api/health from outside (browser or curl) on the public URL; if that works but other routes 502, it’s likely a routing or path issue on the frontend/proxy rather than the backend container.


Loading...