- ✅ Railway CLI - Already installed and linked to your project
- ✅ Project Linked - Connected to project "neetme" (production environment)
- ✅ Debug Script - Created
scripts/debug-railway.shfor easy debugging - ✅ Documentation - Created
RAILWAY_DEBUG.mdwith detailed instructions - ✅ Build Fix - Updated
nixpacks.tomlto ensure public and static files are copied
Since Railway has multiple services, you need to find your web service name:
- Go to https://railway.app
- Open your project "neetme"
- Look at the services list - you'll see services like:
- A PostgreSQL database service
- A web/service for your Next.js app (this is what you need)
- The service name is usually:
web,neetme,api, or similar- It's the one that runs your Next.js app (not the database)
Once you know your service name (let's call it <service-name>):
railway logs -s <service-name> --tail 100railway run -s <service-name> npm run buildrailway run -s <service-name> npm startThis will start your app locally using Railway's environment variables - perfect for debugging!
railway run -s <service-name> env | grep -E "^(DATABASE_URL|NEXT_PUBLIC_|NEXTAUTH_|NODE_ENV)"# Check logs
./scripts/debug-railway.sh logs <service-name>
# Test build
./scripts/debug-railway.sh build <service-name>
# Test start
./scripts/debug-railway.sh start <service-name>
# Show env vars (masked)
./scripts/debug-railway.sh env <service-name>Symptoms: Build fails in Railway Debug:
railway run -s <service-name> npm run buildCommon causes:
- Missing dependencies
- TypeScript errors
- Environment variables missing during build
Symptoms: App builds but doesn't start Debug:
railway run -s <service-name> npm startCommon causes:
.next/standalone/server.jsnot found- Missing
publicor.next/staticfolders (we fixed this in nixpacks.toml) - Database connection errors
- Missing environment variables
Symptoms: App starts but can't connect to database Debug:
railway run -s <service-name> npx prisma db pushCheck:
DATABASE_URLis set correctly- PostgreSQL service is running in Railway
- Database migrations have run
Symptoms: App starts but features don't work Check required variables:
DATABASE_URL(auto-set by Railway PostgreSQL)NEXT_PUBLIC_REOWN_PROJECT_IDNEXT_PUBLIC_APP_URLNEXTAUTH_URLNEXTAUTH_SECRETNODE_ENV=production
- Updated
nixpacks.toml- Added commands to copypublicand.next/staticto standalone directory- This ensures static assets are available when running the standalone server
- Find your service name from Railway dashboard
- Check the logs to see what errors are happening:
railway logs -s <service-name> --tail 100
- Test locally with Railway environment:
railway run -s <service-name> npm start
- Fix any issues you find
- Commit and push - Railway will auto-deploy
- Railway Dashboard: https://railway.app - Check build logs and runtime logs
- Railway Docs: https://docs.railway.com
- Debug Script:
./scripts/debug-railway.sh --help - Full Guide: See
RAILWAY_DEBUG.md
# 1. Find service name (check Railway dashboard)
# Let's say it's "web"
# 2. Check what's happening
railway logs -s web --tail 100
# 3. Test build locally
railway run -s web npm run build
# 4. Test start locally (this will show errors if any)
railway run -s web npm start
# 5. If you see errors, fix them and redeploy
git add .
git commit -m "Fix deployment issues"
git pushGood luck debugging! 🚀