Skip to main content

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'
1

Verify installation

# Check if installed
pnpm list better-auth-studio
2

Install the package

# Install as dev dependency
pnpm add -D better-auth-studio

# Or use pnpx without installation
pnpx better-auth-studio start
3

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
1

Check Node version

node --version
Required: Node.js v18 or higher
2

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.
1

Check file location

The CLI searches for config in:
  • auth.ts
  • src/auth.ts
  • lib/auth.ts
  • Other common locations
2

Specify config path explicitly

pnpx better-auth-studio start --config ./src/lib/auth.ts
3

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
1

Verify auth export

// auth.ts - Ensure you export auth instance
import { betterAuth } from "better-auth";

export const auth = betterAuth({
  database: /* ... */,
  // ... other config
});
2

Check for syntax errors

# Run TypeScript check
pnpm tsc --noEmit
3

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
1

Check database is running

# PostgreSQL
pg_isready

# MySQL
mysqladmin ping

# Check Docker containers
docker ps
2

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"
3

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
1

Run migrations

# Prisma
pnpm prisma migrate dev

# Drizzle
pnpm drizzle-kit push

# Better Auth migration
pnpm better-auth migrate
2

Verify schema

# Prisma - check schema
pnpm prisma db pull

# View current tables
pnpm prisma studio
3

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:
1

Add column to schema

// schema.prisma
model User {
  id           String    @id
  email        String
  // ... other fields
  lastSeenAt   DateTime? // Add this field
}
2

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
1

Find process using port

# Linux/Mac
lsof -i :3002

# Windows
netstat -ano | findstr :3002
2

Kill the process

# Linux/Mac
kill -9 <PID>

# Windows
taskkill /PID <PID> /F
3

Or use different port

pnpx better-auth-studio start --port 3001

Server Won’t Start

Error: Failed to start studio
1

Check for errors in terminal

Look for specific error messages that indicate the root cause.
2

Verify all dependencies

# Reinstall dependencies
rm -rf node_modules
pnpm install
3

Check firewall/antivirus

Ensure your firewall isn’t blocking the port.
4

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.
1

Verify watch mode is enabled

pnpx better-auth-studio start --watch

# Look for this message:
# 👀 Watch mode enabled - config changes will reload automatically
2

Check file permissions

# Ensure file is writable
ls -la src/auth.ts
3

Specify config path

pnpx better-auth-studio start --watch --config ./src/auth.ts
4

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
1

Check for syntax errors

# Validate TypeScript
pnpm tsc --noEmit
2

Look at detailed errors

Check terminal output for specific error messages.
3

Revert recent changes

Undo recent config changes to identify the problematic change.
4

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.
1

Check browser console

Open DevTools (F12) and look for WebSocket errors.
2

Verify WebSocket connection

Look for “Connected to Better Auth Studio (watch mode)” message in browser console.
3

Check firewall/proxy

Some firewalls or proxies block WebSocket connections.
4

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.
1

Check basePath configuration

// studio.config.ts
const config: StudioConfig = {
  basePath: "/api/studio", // Must match your route
};
2

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 };
3

Check access control

access: {
  roles: ["admin"],
  allowEmails: ["[email protected]"],
}
Ensure your user has required role/email.
4

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
1

Check access configuration

access: {
  roles: ["admin"],
  allowEmails: ["[email protected]"],
}
2

Verify user role

Check database to confirm your user has the required role.
3

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'
1

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!
  }
}
2

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
1

Check public directory

Ensure studio assets are included in your build.
2

Verify basePath

metadata: {
  basePath: "/api/studio",
}
basePath must match your route mounting point.
3

Check build output

Verify assets are in the build output directory.

Performance Issues

Slow User List Loading

User list takes too long to load with many users.
1

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);
2

Use pagination

The studio uses pagination by default. Ensure it’s working properly.
3

Optimize queries

Check database slow query logs for optimization opportunities.

High Memory Usage

Studio consumes excessive memory.
1

Limit bulk operations

Reduce the number of records in bulk operations.
2

Check for memory leaks

Restart the studio periodically in development.
3

Optimize database queries

Use selective field queries instead of fetching all data.

Getting Help

Before Opening an Issue

1

Search existing issues

Check GitHub Issues for similar problems.
2

Enable debug mode

Run with additional logging:
DEBUG=* pnpx better-auth-studio start
3

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.

Community Support

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

Build docs developers (and LLMs) love