All guidesMore providers: databases, auth, hosting, email and payments
On this page

Better Auth error

Better Auth

Database schema mismatch: Missing tables user, session, account, verification

By Ohad Krispin, founder of VibeRaven · LinkedIn

"Database schema mismatch" with "Missing tables user, session, account, verification" means Better Auth connected to a database that lacks the tables its config writes. It compares the schema when it starts, logs the mismatch, and fails the requests that wait on that check, in production too. It usually shows on the first deploy because the tables exist only in your local database. With the built-in adapter, run npx auth migrate against the production database. With Drizzle or Prisma, run npx auth generate and apply the result with your ORM's migration tool. Then redeploy and sign in. Reproduced with better-auth 1.7.14 on 2026-10-31.

What do the other lines of the message mean?

The text is built in core/src/db/schema-diff.ts. It can list Missing tables, Missing columns (as table.column), and Required columns Better Auth never writes, which are NOT NULL columns without a default that make every insert fail. The first line names the source: Database for the built-in adapter, Drizzle or Prisma for those adapters, and the help line changes with it. The docs say validation is on by default, including in production, and that it does not stop your server or build. In a run on 2026-10-31 with NODE_ENV=production and an empty SQLite database, the log showed the error once, and the sign-up request threw it. After the tables were created, the same request answered 200.

ERROR [Better Auth]: Database schema mismatch

  Missing tables
    user, session, account, verification

  help: Run npx auth migrate to add the missing tables and columns.

Why does my log show a database error about a missing table instead?

The check can be turned off with advanced.database.validateSchema set to false. Then requests go straight to the database and its own error comes through. With SQLite, a run with validation off printed "no such table: verification" on a sign-in request. Other databases word it their own way, so search the table name from your log. Adapters without a schema check skip validation and write a debug message, or a warning if you set validateSchema to true.

Which command creates the tables for my adapter?

The CLI docs say migrate applies the schema directly and is available only for the built-in Kysely adapter (SQLite or D1, PostgreSQL, MySQL, MSSQL). For Prisma and Drizzle it does not apply, and generate writes the schema for your ORM, which you apply with the ORM's own migration tool. For the built-in adapter, generate writes an SQL file instead. migrate checks the database and prompts before it changes anything; in the CLI help, -y or --yes accepts without prompting. The docs do not describe running it in CI or in the Vercel build.

npx auth@latest migrate
npx auth@latest generate

Checklist

How to fix it, then check the fix

  1. 01Find the "Database schema mismatch" line in the runtime logs of the failing deployment and copy its list of tables and columns.
  2. 02Check which database that deployment uses: the connection variable set in Vercel for that environment. Production and Preview can point at different databases.
  3. 03
    Built-in adapter: run migrate from a shell whose environment holds that database's connection string, the variable your auth config reads. It asks before it changes anything:
    npx auth@latest migrate
  4. 04
    Drizzle or Prisma: generate the schema, then apply it to that database with drizzle-kit or prisma migrate:
    npx auth@latest generate
  5. 05Commit the generated schema or migration file, so every environment gets the same tables.
  6. 06Redeploy, sign up or sign in on the deployment, and check the response is 200 and the logs no longer show "Database schema mismatch".

Related

Sources

Official docs behind this checklist

FAQ

FAQ for builders before launch

Does npx auth migrate work with Drizzle or Prisma?

No. The docs say migrate works with the built-in Kysely adapter only, and that for other adapters you apply the schema with your ORM's migration tool. Run npx auth@latest generate to get the schema for Drizzle or Prisma.

Is npx @better-auth/cli migrate the same command?

Tutorials that name @better-auth/cli use a different package name than the current docs, which show npx auth@latest. Use the form in the docs.

Can I switch the check off?

Set advanced.database.validateSchema to false. The docs say auth migrate and auth generate keep their own diagnostics. The check is what turns a missing table into a message that names the fix, so switching it off leaves you with the raw database error.