Overview
This guide covers common issues you may encounter when using Better Auth Studio and provides step-by-step solutions.
Installation Issues
Cannot Find Module ‘better-auth-studio’
Error: Cannot find module 'better-auth-studio'
Verify installation
# Check if installed
pnpm list better-auth-studio
Install the package
# Install as dev dependency
pnpm add -D better-auth-studio
# Or use pnpx without installation
pnpx better-auth-studio start
Clear package manager cache
# pnpm
pnpm store prune
# npm
npm cache clean --force
# yarn
yarn cache clean
Node Version Incompatibility
Error: The engine "node" is incompatible with this module
Check Node version
Required: Node.js v18 or higher
Update Node.js
Download from nodejs.org or use a version manager: # Using nvm
nvm install 18
nvm use 18
# Using fnm
fnm install 18
fnm use 18
Configuration Issues
Auth Config Not Found
✖ Unable to locate your auth config file
⚠ Unable to locate your auth config file. Watch mode will be disabled for this session.
Check file location
The CLI searches for config in:
auth.ts
src/auth.ts
lib/auth.ts
Other common locations
Specify config path explicitly
pnpx better-auth-studio start --config ./src/lib/auth.ts
Verify file exists
# Check if file exists
ls -la src/auth.ts
Invalid Auth Configuration
✖ Failed to load auth configuration
Error: Auth instance not found or invalid
Verify auth export
// auth.ts - Ensure you export auth instance
import { betterAuth } from "better-auth" ;
export const auth = betterAuth ({
database: /* ... */ ,
// ... other config
});
Check for syntax errors
# Run TypeScript check
pnpm tsc --noEmit
Verify database config
Ensure database adapter is properly configured: import { prismaAdapter } from "better-auth/adapters/prisma" ;
import { PrismaClient } from "@prisma/client" ;
const prisma = new PrismaClient ();
export const auth = betterAuth ({
database: prismaAdapter ( prisma , {
provider: "postgresql" ,
}),
});
Database Issues
Database Connection Failed
Error: Can't reach database server
Error: Connection refused
Check database is running
# PostgreSQL
pg_isready
# MySQL
mysqladmin ping
# Check Docker containers
docker ps
Verify connection string
# Check .env file
cat .env | grep DATABASE_URL
Example formats: # PostgreSQL
DATABASE_URL = "postgresql://user:password@localhost:5432/dbname"
# MySQL
DATABASE_URL = "mysql://user:password@localhost:3306/dbname"
# SQLite
DATABASE_URL = "file:./dev.db"
Test database connection
# Prisma
pnpm prisma db push
# Drizzle
pnpm drizzle-kit push
Missing Database Tables
Error: Table 'user' doesn't exist
Error: relation "user" does not exist
Run migrations
# Prisma
pnpm prisma migrate dev
# Drizzle
pnpm drizzle-kit push
# Better Auth migration
pnpm better-auth migrate
Verify schema
# Prisma - check schema
pnpm prisma db pull
# View current tables
pnpm prisma studio
Reset database (development only)
# ⚠️ This deletes all data!
pnpm prisma migrate reset
Never run migrate reset in production!
lastSeenAt Column Missing
Error: column "lastSeenAt" does not exist
The lastSeenAt feature requires adding the column to your user table:
Add column to schema
// schema.prisma
model User {
id String @id
email String
// ... other fields
lastSeenAt DateTime ? // Add this field
}
Run migration
pnpm prisma migrate dev --name add-last-seen-at
Server Issues
Port Already in Use
Error: listen EADDRINUSE: address already in use :::3002
Find process using port
# Linux/Mac
lsof -i :3002
# Windows
netstat -ano | findstr :3002
Kill the process
# Linux/Mac
kill -9 < PI D >
# Windows
taskkill /PID < PI D > /F
Or use different port
pnpx better-auth-studio start --port 3001
Server Won’t Start
Error: Failed to start studio
Check for errors in terminal
Look for specific error messages that indicate the root cause.
Verify all dependencies
# Reinstall dependencies
rm -rf node_modules
pnpm install
Check firewall/antivirus
Ensure your firewall isn’t blocking the port.
Try minimal config
pnpx better-auth-studio start --no-open --port 3003
Watch Mode Issues
Watch Mode Not Triggering
Config file changes don’t trigger reload.
Verify watch mode is enabled
pnpx better-auth-studio start --watch
# Look for this message:
# 👀 Watch mode enabled - config changes will reload automatically
Check file permissions
# Ensure file is writable
ls -la src/auth.ts
Specify config path
pnpx better-auth-studio start --watch --config ./src/auth.ts
Check for file system issues
Some systems (WSL, Docker volumes) may have issues with file watchers. Try saving the file again or restarting the studio.
Reload Keeps Failing
✖ Reload failed (src/auth.ts) - Unable to reload auth configuration
Check for syntax errors
# Validate TypeScript
pnpm tsc --noEmit
Look at detailed errors
Check terminal output for specific error messages.
Revert recent changes
Undo recent config changes to identify the problematic change.
Restart studio
# Stop with Ctrl+C, then restart
pnpx better-auth-studio start --watch
WebSocket Connection Failed
Browser UI doesn’t update after config changes.
Check browser console
Open DevTools (F12) and look for WebSocket errors.
Verify WebSocket connection
Look for “Connected to Better Auth Studio (watch mode)” message in browser console.
Check firewall/proxy
Some firewalls or proxies block WebSocket connections.
Manually refresh
If WebSocket fails, manually refresh the browser after config changes.
Self-Hosting Issues
Cannot Access Studio in Production
Studio works locally but not in production.
Check basePath configuration
// studio.config.ts
const config : StudioConfig = {
basePath: "/api/studio" , // Must match your route
};
Verify route handler
// app/api/studio/[[...path]]/route.ts
import { betterAuthStudio } from "better-auth-studio/nextjs" ;
import studioConfig from "@/studio.config" ;
const handler = betterAuthStudio ( studioConfig );
export { handler as GET , handler as POST };
Check access control
Ensure your user has required role/email.
Verify build output
# Next.js - check if route exists in build
ls -la .next/server/app/api/studio
Access Denied
403 Forbidden
Access denied to Better Auth Studio
Check access configuration
Verify user role
Check database to confirm your user has the required role.
Check authentication
Ensure you’re logged in with a valid session.
Build & Deployment Issues
Build Fails in Production
Error: Module not found: Can't resolve 'better-auth-studio'
Install as regular dependency
For self-hosting, install as a regular dependency (not devDependency): pnpm add better-auth-studio
// package.json
{
"dependencies" : {
"better-auth-studio" : "latest" // Not in devDependencies!
}
}
Verify build configuration
# Clear build cache
rm -rf .next
pnpm build
CLI usage can use devDependency, but self-hosting requires regular dependency.
Static Assets Not Found
404 Not Found: /assets/index-abc123.js
Check public directory
Ensure studio assets are included in your build.
Verify basePath
metadata : {
basePath : "/api/studio" ,
}
basePath must match your route mounting point.
Check build output
Verify assets are in the build output directory.
Slow User List Loading
User list takes too long to load with many users.
Check database indexes
Ensure proper indexes on frequently queried columns: CREATE INDEX idx_user_email ON user(email);
CREATE INDEX idx_user_created_at ON user(createdAt);
Use pagination
The studio uses pagination by default. Ensure it’s working properly.
Optimize queries
Check database slow query logs for optimization opportunities.
High Memory Usage
Studio consumes excessive memory.
Limit bulk operations
Reduce the number of records in bulk operations.
Check for memory leaks
Restart the studio periodically in development.
Optimize database queries
Use selective field queries instead of fetching all data.
Getting Help
Before Opening an Issue
Enable debug mode
Run with additional logging: DEBUG = * pnpx better-auth-studio start
Gather information
Better Auth Studio version
Node.js version
Database adapter and version
Operating system
Full error messages
Steps to reproduce
Creating an Issue
When opening an issue, include:
## Environment
- Better Auth Studio: v1.x.x
- Node.js: v18.x.x
- Database: PostgreSQL 14
- OS: macOS 13.x
## Steps to Reproduce
1. Run `pnpx better-auth-studio start`
2. Navigate to /users
3. Click "Bulk Seed"
4. Error occurs
## Error Message
[Full error message here]
## Expected Behavior
Bulk seeding should create users without errors.
## Actual Behavior
Error is thrown when trying to create users.
GitHub Issues Report bugs and request features
Discord Get community help and support
Documentation Browse the full documentation
Examples View example implementations
Next Steps
CLI Usage Master the CLI options
Watch Mode Learn about auto-reload
Self-Hosting Deploy to production
Configuration Advanced configuration options