Troubleshooting & Recovery
Diagnose crashes, fix service failures, recover from outages, and resolve common production issues in minutes.
Application Crashed
Server process stopped, 502 errors, PM2 restart loop
Pages Not Loading
Blank pages, 404 errors, SPA routing failures
Database Issues
Connection refused, migration failures, slow queries
Nginx / SSL Issues
Certificate errors, 502 Bad Gateway, subdomain failures
Performance Issues
Slow response, high memory, CPU spikes
Application Crash Recovery Critical
When the MinusNow application process stops or enters a crash loop, follow this escalation path:
Step 1: Check if the process is running
Step 2: Read the error logs
Step 3: Common crash causes & fixes
| Error Message | Cause | Fix |
|---|---|---|
ECONNREFUSED 127.0.0.1:5432 | PostgreSQL is not running | sudo systemctl start postgresql |
ENOMEM / JavaScript heap out of memory | Server ran out of RAM | NODE_OPTIONS="--max-old-space-size=4096" pm2 restart minusnow |
EADDRINUSE :::5000 | Port 5000 already in use | sudo fuser -k 5000/tcp then restart |
MODULE_NOT_FOUND | Missing dependency after update | npm install then pm2 restart minusnow |
relation "..." does not exist | Database migrations not applied | npm run db:push then restart |
SIGKILL / OOM Killer | Linux killed process for memory | Increase server RAM or add swap: sudo fallocate -l 2G /swapfile |
ERR_HTTP2_PROTOCOL_ERROR | Nginx proxy misconfiguration | Check Nginx proxy_pass points to http://127.0.0.1:5000 |
Step 4: Restart the application
Step 5: Verify health
sudo pkill -9 node && cd /opt/minusnow && pm2 start dist/index.cjs --name minusnowPages Not Loading / Blank Pages Common
SPA Routes returning 404
If React SPA routes (like /incidents, /sprints, /sla-heatmap) return 404 in production, the route is missing from server/static.ts.
Marketing Site Pages (404 on /site/products, /site/pricing, etc.)
Static HTML pages must be listed in the ALLOWED_PAGES array in server/static.ts.
Blank white page (JavaScript error)
1. Open browser DevTools (F12)
Check the Console tab for red JavaScript errors. Note the exact error message and file name.
2. Check Network tab
Look for failed requests (red). CSS/JS assets returning 404 means the build output is missing.
3. Rebuild assets
Run npm run build to regenerate all client assets, then pm2 restart minusnow.
4. Clear cache
Hard refresh: Ctrl+Shift+R. Old cached JS can cause hydration errors after deploy.
Subdomain not resolving
Database Issues Critical
PostgreSQL not running
Connection refused in the app
| Check | Command | Expected |
|---|---|---|
| PostgreSQL is running | sudo systemctl status postgresql | Active (running) |
| Listening on port 5432 | sudo ss -tlnp | grep 5432 | LISTEN 0.0.0.0:5432 |
| DATABASE_URL is set | echo $DATABASE_URL | postgresql://user:pass@localhost:5432/minusnow |
| Can connect manually | psql "$DATABASE_URL" -c "SELECT 1" | ?column? = 1 |
Migration / schema errors
Database backup & restore
DROP DATABASE in production. Always use pg_dump before any schema changes. Keep at least 7 days of backups.Nginx & SSL Issues Common
502 Bad Gateway
Nginx received the request but cannot reach the Node.js backend.
SSL certificate expired
Nginx config for MinusNow subdomains
sudo certbot certonly --manual --preferred-challenges=dns -d "*.minusnow.com" -d "minusnow.com" to issue a single certificate that covers all subdomains.Performance Issues Optimization
Diagnose high CPU / memory
Slow API responses
Check database latency
psql "$DATABASE_URL" -c "SELECT now()" -t — should return instantly. Slow = disk I/O issue.
Check active connections
psql "$DATABASE_URL" -c "SELECT count(*) FROM pg_stat_activity" — over 100 suggests connection pool exhaustion.
Check disk space
df -h — if root or data partition is >90%, performance degrades severely.
Restart to reclaim memory
pm2 restart minusnow — Node.js garbage collector sometimes needs a clean restart.
Memory leak detection
Complete Recovery Playbook Emergency
If the entire application is down and you need to recover from scratch, follow these steps in order:
Docker Recovery Container
Quick Reference Commands
| Action | Command |
|---|---|
| Check app status | pm2 status |
| View live logs | pm2 logs minusnow --lines 200 |
| Restart app | pm2 restart minusnow |
| Stop app | pm2 stop minusnow |
| Check health endpoint | curl http://localhost:5000/api/health |
| Start PostgreSQL | sudo systemctl start postgresql |
| Push DB schema | npm run db:push |
| Full rebuild | npm install && npm run build |
| Test Nginx config | sudo nginx -t |
| Reload Nginx | sudo systemctl reload nginx |
| Check SSL cert expiry | sudo certbot certificates |
| Check disk space | df -h |
| Check memory | free -m |
| Kill stuck port | sudo fuser -k 5000/tcp |
| Backup database | pg_dump "$DATABASE_URL" -F c -f backup.dump |