Troubleshooting
Troubleshooting
Section titled “Troubleshooting”Quick fixes for common issues when getting started with Orion Kit.
🚀 Getting Started Issues
Section titled “🚀 Getting Started Issues””Command not found: pnpm"
Section titled “”Command not found: pnpm"”# Install pnpm globally
npm install -g pnpm
# Or use npx
npx pnpm install
"Port already in use"
Section titled “"Port already in use"”# Kill processes on specific ports
lsof -ti:3000 | xargs kill -9
lsof -ti:3001 | xargs kill -9
lsof -ti:3002 | xargs kill -9
lsof -ti:3003 | xargs kill -9
lsof -ti:3004 | xargs kill -9
# Or use different ports
pnpm dev --port 3005
"Module not found” errors
Section titled “"Module not found” errors”# Clear cache and reinstall
rm -rf node_modules
rm pnpm-lock.yaml
pnpm install
🔐 Authentication Issues
Section titled “🔐 Authentication Issues””Unauthorized” errors
Section titled “”Unauthorized” errors”Problem: Getting 401 errors when accessing protected routes
Solutions:
- Sign in first: Visit http://localhost:3001/login
- Check token: Open browser dev tools → Application → Local Storage →
auth_token
- Clear storage: Clear localStorage and try again
”Invalid token” errors
Section titled “”Invalid token” errors”Problem: JWT token is invalid or expired
Solutions:
- Check JWT secret: Ensure
AUTH_JWT_SECRET
is set inapps/api/.env.local
- Regenerate secret: Create new 32+ character secret
- Clear tokens: Clear localStorage and sign in again
CORS errors
Section titled “CORS errors”Problem: “Access to fetch at ‘http://localhost:3002’ from origin ‘http://localhost:3001’ has been blocked by CORS policy”
Solutions:
- Check API URL: Ensure
NEXT_PUBLIC_API_URL=http://localhost:3002
inapps/app/.env.local
- Restart servers: Stop and restart both API and app servers
- Check middleware: Verify CORS is configured in
apps/api/middleware.ts
🗄️ Database Issues
Section titled “🗄️ Database Issues””Database connection failed”
Section titled “”Database connection failed””Problem: Can’t connect to database
Solutions:
- Check DATABASE_URL: Ensure it’s set in
packages/database/.env
- Use pooled connection: For Neon, use “Pooled connection” not “Direct connection”
- Check network: Ensure database is accessible from your IP
”Table doesn’t exist”
Section titled “”Table doesn’t exist””Problem: Database tables not found
Solutions:
- Push schema: Run
pnpm db:push
- Check migrations: Run
pnpm db:migrate
- Reset database: Drop and recreate database
Drizzle Studio won’t open
Section titled “Drizzle Studio won’t open”Problem: Studio shows connection error
Solutions:
- Check DATABASE_URL: Ensure it’s set in
apps/studio/.env.local
- Use correct URL: Visit
https://local.drizzle.studio?port=3003
- Check port: Ensure port 3003 is available
💳 Payment Issues
Section titled “💳 Payment Issues”Stripe webhook errors
Section titled “Stripe webhook errors”Problem: Webhook events not being received
Solutions:
- Start Stripe CLI: Run
stripe listen --forward-to localhost:3002/webhooks/stripe
- Check webhook secret: Ensure
STRIPE_WEBHOOK_SECRET
is set correctly - Check endpoint: Verify webhook URL in Stripe dashboard
”Stripe key not found”
Section titled “”Stripe key not found””Problem: Stripe API keys not working
Solutions:
- Check keys: Ensure you’re using test keys (
pk_test_
,sk_test_
) - Check environment: Keys should be in
apps/api/.env.local
andapps/app/.env.local
- Restart servers: After adding keys, restart all servers
📧 Email Issues
Section titled “📧 Email Issues”Emails not sending
Section titled “Emails not sending”Problem: Welcome emails not being sent
Solutions:
- Check Resend key: Ensure
RESEND_API_KEY
is set inapps/api/.env.local
- Check FROM_EMAIL: Ensure
FROM_EMAIL
is set to a valid domain - Check logs: Look for errors in API logs
”Invalid email address”
Section titled “”Invalid email address””Problem: Email validation failing
Solutions:
- Check format: Ensure email is in valid format
- Check domain: Ensure FROM_EMAIL domain is verified in Resend
- Use test domain: Use
onboarding@resend.dev
for testing
🚀 Deployment Issues
Section titled “🚀 Deployment Issues”Build fails on Vercel
Section titled “Build fails on Vercel”Problem: Deployment fails with build errors
Solutions:
- Check root directory: Set to
apps/api
,apps/app
, orapps/web
- Check Node version: Ensure Node.js 20+ in Vercel settings
- Check environment variables: Ensure all required vars are set
”Environment variable not defined”
Section titled “”Environment variable not defined””Problem: Missing environment variables in production
Solutions:
- Check Vercel dashboard: Ensure all required vars are set
- Check prefixes: Use
NEXT_PUBLIC_
for client-side variables - Redeploy: After adding vars, redeploy the app
CORS errors in production
Section titled “CORS errors in production”Problem: API calls failing in production
Solutions:
- Check URLs: Ensure
NEXT_PUBLIC_API_URL
points to production API - Check CORS: Verify CORS is configured for production domain
- Check HTTPS: Ensure all URLs use HTTPS in production
🔧 Development Issues
Section titled “🔧 Development Issues”Hot reload not working
Section titled “Hot reload not working”Problem: Changes not reflecting in browser
Solutions:
- Check file watching: Ensure file watchers are working
- Restart dev server: Stop and restart
pnpm dev
- Clear cache: Clear browser cache and hard refresh
TypeScript errors
Section titled “TypeScript errors”Problem: Type errors in IDE
Solutions:
- Restart TypeScript: Restart your IDE or TypeScript server
- Check imports: Ensure imports are from correct packages
- Run typecheck: Run
pnpm typecheck
to see all errors
Tests failing
Section titled “Tests failing”Problem: Unit or E2E tests failing
Solutions:
- Check environment: Ensure test environment is set up
- Check database: Ensure test database is accessible
- Run specific test: Run
pnpm test -- --grep "test-name"
🆘 Still Stuck?
Section titled “🆘 Still Stuck?”Get Help
Section titled “Get Help”- Check logs: Look at browser console and server logs
- Search issues: Check GitHub issues
- Open issue: Create new issue with:
- Error message
- Steps to reproduce
- Environment details
- Screenshots if applicable
Useful Commands
Section titled “Useful Commands”# Check all services
pnpm dev
# Check database
pnpm db:studio
# Check types
pnpm typecheck
# Run tests
pnpm test
# Check build
pnpm build
Debug Mode
Section titled “Debug Mode”# Run with debug logs
DEBUG=* pnpm dev
# Check specific service
pnpm --filter api dev
pnpm --filter app dev
Need more help? Check our Complete Documentation or open an issue.