10 KiB
Troubleshooting Guide
Overview
This guide helps developers diagnose and resolve common issues encountered when working with the Compass codebase. It covers setup problems, development environment issues, testing challenges, and deployment concerns.
Development Environment Setup
Node.js Version Issues
Problem: Version compatibility errors when running yarn install or yarn dev
Solution:
- Check required Node.js version in
backend/api/package.json(should be >=20.9.0) - Use
nvmto manage Node versions:
# Install nvm if not already installed
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install and use correct Node version
nvm install 20.9.0
nvm use 20.9.0
Yarn Installation Problems
Problem: Commands like yarn dev fail with module not found errors
Solution:
- Ensure Yarn is installed globally:
npm install --global yarn
- Install dependencies with frozen lockfile:
yarn install --frozen-lockfile
- If issues persist, clean install:
rm -rf node_modules yarn.lock
yarn install
Docker Installation Issues
Problem: Supabase or Firebase emulators fail to start
Solution:
- Verify Docker installation:
docker --version
- Start Docker daemon (Linux):
sudo systemctl start docker
sudo usermod -aG docker $USER
# Log out and back in
- For snap-installed Docker issues, use native Docker:
sudo snap remove docker
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
# Log out and back in
Database and Emulators
Supabase Issues
Problem: yarn dev:isolated fails to start Supabase services
Solution:
- Check if Supabase CLI is installed:
npx supabase --version
- Stop conflicting processes:
supabase stop --no-backup
- Reset and restart:
yarn test:db:reset
- Check Supabase status:
supabase status
Firebase Emulator Problems
Problem: Authentication or storage emulator fails to start
Solution:
- Verify Java 21+ installation:
java -version
- Kill stale emulator processes:
pkill -f "firebase emulators"
pkill -f "java.*emulator"
- Start emulators:
yarn emulate
Port Conflicts
Problem: Services fail to start with "port already in use" errors
Solution:
- Check which process is using the port:
lsof -i :54321 # Supabase
lsof -i :9099 # Firebase Auth
lsof -i :8088 # Backend API
lsof -i :3000 # Next.js
- Kill conflicting processes:
kill -9 <PID>
- Alternative ports can be configured in
.envfiles
Testing Issues
Jest Test Failures
Problem: Tests fail with import or module errors
Solution:
- Run tests with verbose output to see specific errors:
yarn test --verbose
- Clear Jest cache:
yarn test --clearCache
- Run specific test files to isolate issues:
yarn test path/to/specific.test.ts
Playwright E2E Test Problems
Problem: E2E tests fail to run or browsers won't start
Solution:
- Install Playwright browsers:
npx playwright install
- Run E2E tests in headed mode for debugging:
yarn test:e2e:dev --headed
- Check if services are running:
# Should show running services
curl http://localhost:9099 # Firebase Auth
curl http://localhost:8088/health # Backend API
curl http://localhost:3000 # Next.js
Test Data Issues
Problem: Tests fail due to data conflicts or missing fixtures
Solution:
- Reset test database:
yarn test:db:reset
- Ensure unique test data per test:
// Always use unique identifiers
const testId = crypto.randomUUID()
const email = `test+${testId}@test.compass`
const username = `user_${testId}`
- Clean up test data in afterEach:
afterEach(async () => {
await deleteUser(email, password) // only the one this test created
})
API and Backend Issues
Authentication Errors
Problem: API calls return 401 Unauthorized
Solution:
- Verify Firebase authentication:
# Check if Firebase is properly configured
firebase login
- Check JWT token validity:
# In browser console
console.log(firebase.auth().currentUser.getIdToken())
- Verify environment variables in
.env:
NEXT_PUBLIC_FIREBASE_ENV=DEV
Database Connection Errors
Problem: "Connection refused" or timeout errors
Solution:
- Check if database services are running:
docker ps | grep supabase
- Verify database URL in
.env:
DATABASE_URL=postgresql://postgres:postgres@localhost:54322/postgres
- Test database connection:
psql postgresql://postgres:postgres@localhost:54322/postgres
Rate Limiting Issues
Problem: API calls return 429 Too Many Requests
Solution:
- Check rate limiting configuration:
# In development, you can adjust limits
API_RATE_LIMIT_PER_MIN_AUTHED=1000
API_RATE_LIMIT_PER_MIN_UNAUTHED=100
- Add delays between repeated API calls in tests:
await new Promise((resolve) => setTimeout(resolve, 100))
Frontend Issues
Build Errors
Problem: yarn build fails with TypeScript or compilation errors
Solution:
- Run type checking separately:
yarn typecheck
- Check for unused variables or imports:
yarn lint
- Clear Next.js cache:
yarn clear-nextjs-cache
Hot Reload Issues
Problem: Code changes don't reflect in development server
Solution:
- Restart development server:
yarn dev
- Check for syntax errors that prevent hot reload:
# Watch for compilation errors in terminal
- Clear browser cache:
# Hard refresh (Ctrl+F5 or Cmd+Shift+R)
Styling Problems
Problem: CSS or Tailwind classes not applying correctly
Solution:
- Check Tailwind configuration in
tailwind.config.js - Verify CSS imports in
_app.tsx:
import '../styles/globals.css'
- Restart development server to regenerate CSS
Mobile Development Issues
Android Build Failures
Problem: yarn build-sync-android fails
Solution:
- Ensure Android Studio and SDK are installed
- Check environment variables:
ANDROID_HOME=/path/to/android/sdk
- Sync Gradle dependencies:
cd android
./gradlew clean
./gradlew build
Capacitor Plugin Issues
Problem: Native plugins not working
Solution:
- Update Capacitor plugins:
npx cap sync
- Check plugin compatibility with target platform versions
Common Error Messages and Solutions
"Module not found" Errors
Cause: Missing dependencies or incorrect import paths Solution:
- Reinstall dependencies:
yarn install --force - Check import paths for typos
- Ensure files exist at referenced locations
"TypeError: Cannot read property of undefined"
Cause: Attempting to access properties on null/undefined values Solution:
- Add proper null checks:
user?.profile?.name ?? 'Anonymous'
- Initialize objects properly:
const [userData, setUserData] = useState<User | null>(null)
"Network error" or "Connection refused"
Cause: Services not running or incorrect URLs Solution:
- Verify all services are running with
yarn devoryarn dev:isolated - Check environment variables for correct URLs
- Test service connectivity individually
Performance Issues
Slow Development Server
Problem: Pages take a long time to load locally
Solution:
- Use isolated development mode:
yarn dev:isolated
- Check for memory leaks with:
yarn disk-space-info
- Monitor resource usage in Activity Monitor/Task Manager
Large Bundle Sizes
Problem: Production builds are too large
Solution:
- Analyze bundle size:
yarn build && npx webpack-bundle-analyzer .next/static/chunks
- Implement code splitting for large components
- Remove unused dependencies
Debugging Techniques
Console Logging
- Structured Logging: Use the application logger:
import {logger} from 'common/logger'
logger.info('Processing user data', {userId: auth.uid, step: 'validation'})
- Debug Statements: Use debug mode in development:
import {debug} from 'common/logger'
debug('Variable state:', variable)
Browser Debugging
- React DevTools: Install browser extension for component inspection
- Network Tab: Monitor API calls and response times
- Console Tab: Check for JavaScript errors
Backend Debugging
- Add Logging: Insert strategic log statements in API handlers
- Use Debugger: Run API with debug mode:
yarn debug
- Database Query Analysis: Use
EXPLAIN ANALYZEfor slow queries
Environment-Specific Issues
Production vs Development Differences
Problem: Code works in development but fails in production
Solution:
- Check environment variables and secrets management
- Verify build process differences (minification, etc.)
- Test with production-like data sets
CI/CD Pipeline Failures
Problem: GitHub Actions fail unexpectedly
Solution:
- Check workflow logs for specific error messages
- Ensure all secrets are properly configured in repository settings
- Verify Node.js and dependency versions match local environment
Best Practices for Issue Resolution
- Reproduce Consistently: Create minimal reproduction cases
- Check Recent Changes: Use git history to identify problematic changes
- Isolate Variables: Test one change at a time
- Read Error Messages Carefully: Often contain specific hints about the root cause
- Search Existing Issues: Check GitHub issues and Discord discussions
- Ask for Help: Reach out to the community on Discord or GitHub
Getting Further Help
If you're unable to resolve an issue:
- Check Existing Issues: https://github.com/CompassConnections/Compass/issues
- Ask on Discord: https://discord.gg/8Vd7jzqjun
- Email Support: hello@compassmeet.com
- Create a GitHub Issue: Include:
- Detailed error messages
- Steps to reproduce
- Environment information (OS, Node version, etc.)
- Screenshots or code snippets if relevant
Last Updated: March 2026