Troubleshooting
Learn how to troubleshoot common issues with your Nuxt Starter Kit application.
JavaScript heap out of memory error during build
The FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory error occurs when the Node.js process runs out of memory during build. This is related to this Vite issue.
Solution: Increase the memory limit by setting the NODE_OPTIONS environment variable:
NODE_OPTIONS=--max-old-space-size=8192 pnpm build
For CI/CD deployments, add this environment variable in your deployment platform's settings.
Database connection issues
If you're having trouble connecting to PostgreSQL:
- Check connection string format:
NUXT_PRIVATE_DATABASE_URL="postgresql://user:password@host:5432/dbname" - Verify database is running:
psql $NUXT_PRIVATE_DATABASE_URL -c "SELECT version();" - Check firewall rules: Ensure your database accepts connections from your deployment
- SSL/TLS issues: Some providers require SSL. Try adding
?sslmode=requireto your connection string
Turborepo cache issues
If builds are failing or using stale code:
# Clear Turborepo cache
pnpm exec turbo clean
# Clear node_modules and reinstall
rm -rf node_modules
pnpm install
Layer resolution issues
If layers aren't being found:
- Ensure layers are built: Run
pnpm buildfrom root - Check workspace configuration: Verify
pnpm-workspace.yamlincludes your layers - Reference by name, not path: Use
'layer-auth'not'../packages/layer-auth'
Better-auth session issues
If users are being logged out unexpectedly:
- Check BETTER_AUTH_SECRET: Must be at least 32 characters
- Verify BETTER_AUTH_URL: Should match your actual domain
- Check database sessions: Verify sessions table has entries
Migration issues
If migrations fail:
# Reset migrations (WARNING: destroys data)
pnpm db:drop
pnpm db:generate
pnpm db:migrate
# Or manually apply SQL
psql $NUXT_PRIVATE_DATABASE_URL < packages/layer-auth/server/db/migrations/XXXX.sql
Type errors in development
If you're seeing TypeScript errors:
# Regenerate types
pnpm postinstall
# Or manually
nuxt prepare
Deployment fails
Common deployment issues:
- Missing environment variables: Double-check all required vars are set
- Database migrations not run: Run
pnpm db:migrateafter deployment - Build timeout: Increase timeout in your platform settings
- Dependency installation: Try
pnpm install --frozen-lockfile
Getting Help
If you're still stuck:
- Review the GitHub issues
- Contact support via email (available to customers)