Troubleshooting Guide
Common issues and solutions when working with the Sprout platform.
Quick Diagnosis
Service Won't Start
-
Check environment variables:
doppler secrets -
Check Docker services:
docker ps
docker-compose ps -
Check logs:
# Backend
doppler run -- bun run start:dev
# Docker logs
docker-compose logs -f
Database Connection Issues
Symptoms: Connection refused, timeout, authentication failed
Solutions:
-
Verify PostgreSQL is running:
docker ps | grep postgres -
Check connection string in Doppler:
doppler secrets get DATABASE_URL -
Test connection:
docker exec -it <postgres_container> psql -U postgres -c "SELECT 1" -
Verify migrations are applied:
doppler run -- npx prisma migrate status
Redis Connection Issues
Symptoms: Queue not processing, cache not working
Solutions:
-
Verify Redis is running:
docker ps | grep redis -
Test Redis connection:
docker exec -it <redis_container> redis-cli ping -
Check Redis URL in Doppler:
doppler secrets get REDIS_URL
Port Already in Use
Symptoms: EADDRINUSE error
Solutions:
-
Find what's using the port:
lsof -i :3000 -
Kill the process or change port:
kill -9 <PID>
# Or change PORT in Doppler
TypeScript Errors
Symptoms: Type errors, compilation failures
Solutions:
-
Regenerate Prisma client:
bun run postinstall -
Clear node_modules and reinstall:
rm -rf node_modules bun.lockb
bun install -
Check TypeScript version compatibility
Dependency Issues
Symptoms: Module not found, version conflicts
Solutions:
-
Clear cache and reinstall:
rm -rf node_modules bun.lockb
bun install -
Check for version conflicts:
bun outdated -
Verify package.json is correct
Service-Specific Issues
sprout_backend
Worker Not Processing Jobs
-
Check worker is running:
doppler run -- bun run worker:dev -
Check Bull Board: http://localhost:3000/queues
-
Check Redis connection
-
Verify queue configuration
API Endpoints Not Working
-
Check server is running:
curl http://localhost:3000/health -
Check authentication (if required)
-
Verify CORS configuration
-
Check request logs
sprout_etl
Pipeline Not Running
-
Check ETL service is running:
curl http://localhost:3001/health -
Check worker is running:
doppler run -- bun run worker:dev -
Verify queue has jobs:
# Check Redis queue
docker exec -it <redis_container> redis-cli
> LLEN bull:etl_queue:wait
Event Matching Failing
-
Check MeiliSearch is accessible:
curl http://localhost:7700/health -
Verify events are indexed:
# Use CLI to check
doppler run -- bun run cli:dev -- match-events --dry-run --limit 5 -
Check API keys are valid
pricing_dashboard
Build Failing
-
Check TypeScript errors:
bun run build -
Check for missing dependencies:
bun install -
Clear Vite cache:
rm -rf node_modules/.vite
API Calls Failing
-
Verify backend is running:
curl http://localhost:3000/health -
Check CORS configuration
-
Verify API URL in environment:
echo $VITE_API_URL
cloudflare-workers
Deployment Failing
-
Check Wrangler configuration:
bun run check -
Verify Cloudflare credentials:
wrangler whoami -
Check D1 migrations:
bun run seedLocalD1
Worker Not Triggering
-
Check cron schedule in wrangler.json
-
Verify worker is deployed:
wrangler deployments list -
Check worker logs:
wrangler tail
Common Error Messages
"Cannot find module"
Cause: Missing dependency or incorrect import path
Solution:
bun install
# Check import paths match actual file locations
"Prisma Client not generated"
Cause: Prisma client not generated after schema changes
Solution:
bun run postinstall
# Or manually:
npx prisma generate
"Connection refused"
Cause: Service not running or wrong host/port
Solution:
- Verify service is running
- Check connection string
- Verify network/firewall settings
"Rate limit exceeded"
Cause: Too many API requests
Solution:
- Check rate limiting configuration
- Implement backoff/retry logic
- Reduce request frequency
"Migration failed"
Cause: Database schema conflicts
Solution:
-
Check migration status:
npx prisma migrate status -
Resolve conflicts manually if needed
-
Reset database (development only):
npx prisma migrate reset
Debugging Tips
Enable Debug Logging
Set environment variables:
DEBUG=*
LOG_LEVEL=debug
Use Debugger
-
Start in debug mode:
doppler run -- bun run start:debug -
Attach debugger (VS Code):
- Create
.vscode/launch.json - Attach to process on port 9229
- Create
Check Logs
-
Application logs:
# Follow logs
tail -f logs/app.log -
Docker logs:
docker-compose logs -f <service> -
System logs:
journalctl -u <service> -f
Network Debugging
-
Test connectivity:
curl -v http://localhost:3000/health
telnet localhost 5432 -
Check DNS:
nslookup <hostname> -
Verify firewall:
ufw status
Getting Help
- Check existing documentation
- Search error messages in codebase
- Check service logs for detailed errors
- Review recent changes in git history
- Ask team members for context
Prevention
- Always use Doppler for environment variables
- Run migrations before starting services
- Check Docker services are running
- Verify dependencies are installed
- Test locally before deploying
Next Steps
- Environment Setup - Setup guide
- Docker Setup - Docker troubleshooting
- Testing - Test debugging