[GH-ISSUE #1778] "The following field is invalid: Auth Profile > Role" after adding admin plugin #8914

Closed
opened 2026-04-13 04:09:46 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @jancbeck on GitHub (Mar 11, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1778

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. use neondb (postgres), next, google social provider & admin plugin
  2. add some users before enabling the admin plugin
  3. enable the admin plugin
  4. run migrations (I use kysely)
  5. attempt login via google

Current vs. Expected behavior

On attempted login with google, next logs "The following field is invalid: Auth Profile > Role" and the browser shows the BetterAuth error that forwards back to the application.

Looking at the users table I can see the "role" column has been added but it contained nothing. When I added "user" to the existing users role, the error disappeared and users can login correctly.

I'd expect the migrations to not just add the new column but also fill in the default role.

What version of Better Auth are you using?

1.2.3

Provide environment information

- OS: Vercel (??)
- Browser: latest Safari / Chrome

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  plugins: [expo(), admin(), openAPI()],
  database: {
    dialect: new PostgresDialect({
      pool: new Pool({
        connectionString: process.env.BETTER_AUTH_DATABASE_URI,
      }),
    }),
    type: "postgres",
  },
  emailAndPassword: {
    enabled: false,
  },
  socialProviders: {
    google: {
      clientId: String(process.env.GOOGLE_CLIENT_ID),
      clientSecret: String(process.env.GOOGLE_CLIENT_SECRET),
    },
    apple: {
      clientId: String(process.env.APPLE_CLIENT_ID),
      clientSecret: String(process.env.APPLE_CLIENT_SECRET),
    },
  },
  account: {
    accountLinking: {
      enabled: true,
    },
  },
})

Additional context

No response

Originally created by @jancbeck on GitHub (Mar 11, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1778 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. use neondb (postgres), next, google social provider & admin plugin 2. add some users before enabling the admin plugin 3. enable the admin plugin 4. run migrations (I use kysely) 5. attempt login via google ### Current vs. Expected behavior On attempted login with google, next logs "The following field is invalid: Auth Profile > Role" and the browser shows the BetterAuth error that forwards back to the application. Looking at the users table I can see the "role" column has been added but it contained nothing. When I added "user" to the existing users role, the error disappeared and users can login correctly. I'd expect the migrations to not just add the new column but also fill in the default role. ### What version of Better Auth are you using? 1.2.3 ### Provide environment information ```bash - OS: Vercel (??) - Browser: latest Safari / Chrome ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ plugins: [expo(), admin(), openAPI()], database: { dialect: new PostgresDialect({ pool: new Pool({ connectionString: process.env.BETTER_AUTH_DATABASE_URI, }), }), type: "postgres", }, emailAndPassword: { enabled: false, }, socialProviders: { google: { clientId: String(process.env.GOOGLE_CLIENT_ID), clientSecret: String(process.env.GOOGLE_CLIENT_SECRET), }, apple: { clientId: String(process.env.APPLE_CLIENT_ID), clientSecret: String(process.env.APPLE_CLIENT_SECRET), }, }, account: { accountLinking: { enabled: true, }, }, }) ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 04:09:46 -05:00
Author
Owner

@Kinfe123 commented on GitHub (May 5, 2025):

is this still an issue ?

<!-- gh-comment-id:2849845041 --> @Kinfe123 commented on GitHub (May 5, 2025): is this still an issue ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8914