v1.4.7: role field required in Drizzle schema even without admin plugin #2613

Closed
opened 2026-03-13 10:07:14 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @kevin-courbet on GitHub (Dec 26, 2025).

Originally assigned to: @bytaesu on GitHub.

To Reproduce

  1. Use better-auth 1.4.5 with Drizzle adapter + PostgreSQL (works fine, no admin plugin)
  2. Upgrade to 1.4.7
  3. Attempt any auth flow (e.g., OTP sign-in verification)
  4. Error thrown during authentication

Current vs. Expected behavior

Current: Authentication fails with error:

ERROR [Better Auth]: The field "role" does not exist in the "user" Drizzle schema.
Please update your drizzle schema or re-generate using "npx @better-auth/cli@latest generate".

Expected: The role field validation should only apply when the admin plugin is explicitly used. Without admin plugin, auth should work without requiring the role column.

Auth config (no admin plugin)

import { passkey } from "@better-auth/passkey";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { nextCookies } from "better-auth/next-js";
import { customSession, emailOTP } from "better-auth/plugins";

export const auth = betterAuth({
  database: drizzleAdapter(db, {
    provider: "pg",
    schema: { account, passkey: passkeyTable, session, user, verification },
  }),
  plugins: [
    customSession(async ({ user, session }) => { /* enriches session */ }),
    emailOTP({ /* config */ }),
    passkey({ /* config */ }),
    nextCookies(),
  ],
});

Provide environment information

{
  "os": "darwin",
  "framework": "next.js 16",
  "database": "PostgreSQL (Neon)",
  "dependencies": [
    { "name": "@better-auth/passkey", "version": "1.4.4" },
    { "name": "drizzle-orm", "version": "0.41.x" },
    { "name": "@neondatabase/serverless", "version": "0.10.4" }
  ],
  "betterAuth": { "version": "1.4.7" }
}

Affected area

Backend (Drizzle adapter validation)

Workaround

Pin to 1.4.5 or add role column manually:

ALTER TABLE "user" ADD COLUMN role TEXT NOT NULL DEFAULT 'user';
Originally created by @kevin-courbet on GitHub (Dec 26, 2025). Originally assigned to: @bytaesu on GitHub. ## To Reproduce 1. Use better-auth 1.4.5 with Drizzle adapter + PostgreSQL (works fine, no admin plugin) 2. Upgrade to 1.4.7 3. Attempt any auth flow (e.g., OTP sign-in verification) 4. Error thrown during authentication ## Current vs. Expected behavior **Current:** Authentication fails with error: ``` ERROR [Better Auth]: The field "role" does not exist in the "user" Drizzle schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli@latest generate". ``` **Expected:** The `role` field validation should only apply when the admin plugin is explicitly used. Without admin plugin, auth should work without requiring the role column. ## Auth config (no admin plugin) ```typescript import { passkey } from "@better-auth/passkey"; import { betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { nextCookies } from "better-auth/next-js"; import { customSession, emailOTP } from "better-auth/plugins"; export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "pg", schema: { account, passkey: passkeyTable, session, user, verification }, }), plugins: [ customSession(async ({ user, session }) => { /* enriches session */ }), emailOTP({ /* config */ }), passkey({ /* config */ }), nextCookies(), ], }); ``` ## Provide environment information ```json { "os": "darwin", "framework": "next.js 16", "database": "PostgreSQL (Neon)", "dependencies": [ { "name": "@better-auth/passkey", "version": "1.4.4" }, { "name": "drizzle-orm", "version": "0.41.x" }, { "name": "@neondatabase/serverless", "version": "0.10.4" } ], "betterAuth": { "version": "1.4.7" } } ``` ## Affected area Backend (Drizzle adapter validation) ## Workaround Pin to 1.4.5 or add role column manually: ```sql ALTER TABLE "user" ADD COLUMN role TEXT NOT NULL DEFAULT 'user'; ```
GiteaMirror added the bug label 2026-03-13 10:07:14 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 26, 2025):

The issue with the "role" field being required in the Drizzle schema appears to be a new enforcement in version 1.4.7 of Better Auth. Based on existing discussions, it seems that this may not align with expected behavior, particularly since the admin plugin is not being used in your configuration, and you have explicitly opted out of requiring the "role" field.

To resolve this error, you have a couple of options:

  1. Pin to version 1.4.5, where this issue was not present.
  2. Manually add the "role" column to your "user" table in the database, as your workaround suggests:
    ALTER TABLE "user" ADD COLUMN role TEXT NOT NULL DEFAULT 'user';
    

It’s also worth mentioning that this situation may warrant further attention from the Better Auth team, so if the problem persists, consider tagging @bekacru or @ping__ in your follow-up queries.

Have you been able to implement either of those workarounds successfully, or do you need help with something else?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Dec 26, 2025): The issue with the "role" field being required in the Drizzle schema appears to be a new enforcement in version 1.4.7 of Better Auth. Based on existing discussions, it seems that this may not align with expected behavior, particularly since the admin plugin is not being used in your configuration, and you have explicitly opted out of requiring the "role" field. To resolve this error, you have a couple of options: 1. **Pin to version 1.4.5**, where this issue was not present. 2. **Manually add the "role" column** to your "user" table in the database, as your workaround suggests: ```sql ALTER TABLE "user" ADD COLUMN role TEXT NOT NULL DEFAULT 'user'; ``` It’s also worth mentioning that this situation may warrant further attention from the Better Auth team, so if the problem persists, consider tagging @bekacru or @ping__ in your follow-up queries. Have you been able to implement either of those workarounds successfully, or do you need help with something else? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@kevin-courbet commented on GitHub (Dec 26, 2025):

Confirmed: adding the role column manually resolves the issue.

However, this is a semver violation — requiring a new database column in a minor version (1.4.5 → 1.4.7) is a breaking change. Users upgrading patch/minor versions don't expect their auth to break without schema migrations.

The role field should only be validated when the admin plugin is explicitly added to the plugins array.

@kevin-courbet commented on GitHub (Dec 26, 2025): Confirmed: adding the `role` column manually resolves the issue. However, this is a **semver violation** — requiring a new database column in a minor version (1.4.5 → 1.4.7) is a breaking change. Users upgrading patch/minor versions don't expect their auth to break without schema migrations. The role field should only be validated when the admin plugin is explicitly added to the plugins array.
Author
Owner

@bytaesu commented on GitHub (Dec 26, 2025):

Hi @kevin-courbet,

I tested this in an actual app using the Drizzle adapter, but couldn't reproduce the issue 🤔
I also don’t see anything in the internal logic that would cause this at the moment. Could you share a minimal reproducible repo?

@bytaesu commented on GitHub (Dec 26, 2025): Hi @kevin-courbet, I tested this in an actual app using the Drizzle adapter, but couldn't reproduce the issue 🤔 I also don’t see anything in the internal logic that would cause this at the moment. Could you share a minimal reproducible repo?
Author
Owner

@kevin-courbet commented on GitHub (Dec 27, 2025):

Strange, I couldn't produce a reproducible repo either. Due to this, I think it's safe to assume this was some isolated happenstance and not systematic. Closing this in light of this, thank you for looking into it @bytaesu

@kevin-courbet commented on GitHub (Dec 27, 2025): Strange, I couldn't produce a reproducible repo either. Due to this, I think it's safe to assume this was some isolated happenstance and not systematic. Closing this in light of this, thank you for looking into it @bytaesu
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2613