Skip to main content

Deployment Troubleshooting Guide

Comprehensive troubleshooting guide for Hyperscape deployments across Cloudflare Pages, Railway, and Vast.ai.

Table of Contents

Cloudflare Pages

Build Fails with Module Resolution Errors

Symptoms:
Cause: Vite polyfills shims not resolving to dist files. Fix (commit e012ed2):

CSP Errors Loading Google Fonts

Symptoms:
Cause: Content Security Policy doesn’t allow Google Fonts. Fix (commit e012ed2):

CORS Errors Loading Assets from R2

Symptoms:
Cause: R2 bucket CORS not configured. Fix (commit 143914d):
CORS config format:

Multi-line Commit Messages Break Deploy

Symptoms:
Cause: Workflow doesn’t handle multi-line commit messages. Fix (commit 3e4bb48):

Railway

Database Connection Fails

Symptoms:
Cause: DATABASE_URL not set or incorrect. Fix:
  1. Get DATABASE_URL from Railway dashboard (PostgreSQL plugin)
  2. Add to Railway environment variables
  3. Redeploy
Verify:

CSRF Errors from Cloudflare Pages

Symptoms:
Cause: Cross-origin requests from Cloudflare Pages to Railway server. Fix: CSRF validation now skipped for known clients (commit 8626299):

Port Conflicts

Symptoms:
Cause: Port 5555 already in use. Fix:

Vast.ai

Xorg Fails to Start

Symptoms:
Cause: NVIDIA driver issues, display already in use, or missing dependencies. Fix:
Fallback: Deployment automatically falls back to Xvfb (software rendering).

WebGPU Not Available

Symptoms:
Cause: Vulkan not working, wrong Chrome channel, or Xvfb fallback. Fix:

PulseAudio Not Working

Symptoms:
Cause: PulseAudio not running, chrome_audio sink missing, or permission errors. Fix:
See Streaming Audio Capture for full guide.

Stream Not Appearing on Platforms

Symptoms:
  • Stream key configured but no stream on Twitch/Kick/X
  • FFmpeg running but no output
Cause: Wrong stream key, wrong RTMP URL, or network issues. Fix:
Correct URLs (commit 5dbd239):
  • Twitch: rtmp://live.twitch.tv/app
  • Kick: rtmps://fa723fc1b171.global-contribute.live-video.net/app
  • X: rtmp://sg.pscp.tv:80/x

DATABASE_URL Not Persisting

Symptoms:
Cause: Git reset overwrites .env file. Fix (commit eec04b0): Secrets are now written to /tmp/hyperscape-secrets.env before git reset, then copied back after. Verify:

PM2 Process Crashes Immediately

Symptoms:
Cause: Missing dependencies, database connection failure, or configuration errors. Fix:

Maintenance Mode Fails

Symptoms:
Cause: Server not healthy, ADMIN_CODE wrong, or server URL incorrect. Fix:

Bun Not Found

Symptoms:
Cause: Bun not installed or not in PATH. Fix (commit abfe0ce):
The deploy script now checks for bun and installs automatically.

Database Issues

Schema Migration Fails

Symptoms:
Cause: Database schema not pushed or migrations not run. Fix:

Database Connection Timeout

Symptoms:
Cause: Database cold start or network issues. Fix (commit dda4396): Database warmup with 3 retry attempts:

Stale Schema After Pull

Symptoms:
  • Missing columns
  • Type errors
  • Constraint violations
Cause: Local database schema doesn’t match code. Fix:

Streaming Issues

No Audio in Stream

Symptoms:
  • Video works but no audio
  • Silent stream
Cause: PulseAudio not running, chrome_audio sink missing, or FFmpeg not capturing. Fix:
See Streaming Audio Capture for full guide.

Audio/Video Desync

Symptoms:
  • Audio plays ahead or behind video
  • Gradual drift over time
Cause: Missing wall clock timestamps or async resampling. Fix (commit b9d2e41):

Stream Buffering on Viewers

Symptoms:
  • Viewers experience frequent buffering
  • Stream quality drops
Cause: Insufficient buffer size or zerolatency tune. Fix (commit 4c630f1):

FFmpeg Crashes

Symptoms:
Cause: Invalid arguments, missing codecs, or RTMP connection failure. Fix:

Security & Secrets

JWT_SECRET Missing Error

Symptoms:
Cause: JWT_SECRET not set in production. Fix:
Note: This is now enforced in production/staging (commit b56b0fd).

Stream Keys Not Working

Symptoms:
  • Stream keys configured but streams don’t appear
  • FFmpeg shows “Connection refused”
Cause: Stale stream keys in environment override .env values. Fix (commit a71d4ba):

Solana Keypair Not Found

Symptoms:
Cause: SOLANA_DEPLOYER_PRIVATE_KEY not set or decode-key.ts not run. Fix (commit 8a677dc):

Secrets Lost After Git Reset

Symptoms:
  • DATABASE_URL works initially but fails after deployment
  • Stream keys stop working after git pull
Cause: Git reset overwrites .env file. Fix (commit eec04b0): Secrets are now written to /tmp/hyperscape-secrets.env before git reset:

Common Error Messages

”Failed to resolve module specifier”

Fix: Update Vite config with polyfill aliases (commit e012ed2).

”WebGPU is not supported”

Fix: Use Chrome 113+, Edge 113+, or Safari 18+. Check webgpureport.org.

”CSRF token validation failed”

Fix: CSRF now skipped for cross-origin (commit 8626299). Update server code.

”Connection refused” (database)

Fix: Set DATABASE_URL, run database warmup (commit dda4396).

”Keypair file not found”

Fix: Set SOLANA_DEPLOYER_PRIVATE_KEY, run decode-key.ts (commit 8a677dc).

”PulseAudio: Connection refused”

Fix: Start PulseAudio, create chrome_audio sink. See Streaming Audio Capture.

”FFmpeg: No such file or directory”

Fix: Install FFmpeg (apt-get install ffmpeg) or set FFMPEG_PATH.

”Port already in use”

Fix: Kill process on port (lsof -ti:5555 | xargs kill -9) or use different port.

Diagnostic Commands

Check All Services

Check Environment Variables

Check Logs

Performance Issues

High CPU Usage

Symptoms:
  • CPU > 90%
  • Lag or frame drops
Cause: Too many agents, high encoding quality, or inefficient code. Fix:

High Memory Usage

Symptoms:
  • Memory > 4GB
  • PM2 restarts process
Cause: Memory leaks, too many agents, or large buffers. Fix:

Stream Lag or Stuttering

Symptoms:
  • Choppy video
  • Audio dropouts
  • Frame drops
Cause: Insufficient buffering, network issues, or CPU overload. Fix:

Network Issues

WebSocket Connection Fails

Symptoms:
Cause: Wrong URL, firewall, or server not running. Fix:

CORS Errors

Symptoms:
Cause: Missing CORS headers or R2 CORS not configured. Fix: