Skip to content

Latest commit

 

History

History
104 lines (75 loc) · 2.93 KB

File metadata and controls

104 lines (75 loc) · 2.93 KB

Railway Deployment Issues - Debugging Summary

🔴 Critical Issue Found: Missing Static Files

Problem: The public and .next/static folders are not being copied to the standalone build directory in Railway. This causes the app to fail when trying to serve static assets (images, CSS, JS chunks).

Evidence:

  • Railway logs show app starts successfully
  • But when checking the standalone directory: public and .next/static are missing
  • This causes 404 errors for all static assets

Fix Applied: ✅ Updated nixpacks.toml to copy these folders after build:

[phases.build]
cmds = [
  "npm run build",
  "cp -r public .next/standalone/public || true",
  "cp -r .next/static .next/standalone/.next/static || true"
]

Action Required: Commit and push this change to trigger a new Railway deployment.


⚠️ Issue 2: Missing NEXTAUTH_URL

Problem: NEXTAUTH_URL environment variable is not set in Railway.

Current Environment Variables:

  • DATABASE_URL - Set correctly
  • NEXT_PUBLIC_REOWN_PROJECT_ID - Set correctly
  • NEXT_PUBLIC_APP_URL - Set to https://neetme-production.up.railway.app/
  • NEXTAUTH_URL - MISSING
  • NEXTAUTH_SECRET - MISSING

Fix Required: Add these environment variables in Railway dashboard:

  1. Go to Railway dashboard → Your project → Variables
  2. Add:
    • NEXTAUTH_URL = https://neetme-production.up.railway.app (no trailing slash)
    • NEXTAUTH_SECRET = Generate with: openssl rand -base64 32

Note: Even though you're using Reown for auth, NEXTAUTH_URL and NEXTAUTH_SECRET are still used for session management.


📋 Next Steps

  1. Commit and push the nixpacks.toml fix:

    git add nixpacks.toml
    git commit -m "Fix: Copy public and static folders to standalone build"
    git push
  2. Add missing environment variables in Railway:

    • Go to Railway dashboard
    • Project → Variables
    • Add NEXTAUTH_URL = https://neetme-production.up.railway.app
    • Add NEXTAUTH_SECRET = (generate with openssl rand -base64 32)
  3. Wait for Railway to redeploy (automatic after push)

  4. Verify the fix:

    # Check logs after deployment
    railway logs -s neetme --tail 50
    
    # Verify static files are present
    railway run -s neetme sh -c "ls -la .next/standalone/public .next/standalone/.next/static"

✅ What's Working

  • ✅ Build process completes successfully
  • ✅ App starts without errors
  • ✅ Database connection is configured
  • ✅ Reown project ID is set correctly
  • ✅ Railway CLI is connected and working

🔍 Testing Locally

To test the fix locally before deploying:

# Build with the fix
npm run build

# Copy static files (simulating nixpacks.toml)
cp -r public .next/standalone/public
cp -r .next/static .next/standalone/.next/static

# Test start locally
npm start

Then visit http://localhost:3000 to verify static assets load correctly.