[GH-ISSUE #620] The field "scope" does not exist in the "account" schema. #8347

Closed
opened 2026-04-13 03:25:13 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @avanderbergh on GitHub (Nov 22, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/620

Describe the bug

I get the error:

[A [BetterAuthError]: The field "accessTokenExpiresAt" does not exist in the "account" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".] {
  cause: undefined
}

[Better Auth]  ERROR   unable_to_create_user

from the endpoint: /api/auth/callback/github

But this seems be be incorrect, since accessTokenExpiresAt should be mapped to session.expiresAt.

To Reproduce
Steps to reproduce the behavior:

  1. Sign in with an OAuth provider for a new user.

Additional context

Version: 1.0.0-canary.14
Database Adapter: drizzleAdapter(db, { provider: "sqlite" }),

Originally created by @avanderbergh on GitHub (Nov 22, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/620 **Describe the bug** I get the error: ```bash [A [BetterAuthError]: The field "accessTokenExpiresAt" does not exist in the "account" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".] { cause: undefined } [Better Auth] ERROR unable_to_create_user ``` from the endpoint: `/api/auth/callback/github` But this seems be be incorrect, since `accessTokenExpiresAt` should be mapped to `session.expiresAt`. **To Reproduce** Steps to reproduce the behavior: 1. Sign in with an OAuth provider for a new user. **Additional context** Version: `1.0.0-canary.14` Database Adapter: `drizzleAdapter(db, { provider: "sqlite" }),`
GiteaMirror added the locked label 2026-04-13 03:25:13 -05:00
Author
Owner

@avanderbergh commented on GitHub (Nov 22, 2024):

Ah, never mind... I new saw the modified schema for the accounts table in the beta docs

<!-- gh-comment-id:2494045946 --> @avanderbergh commented on GitHub (Nov 22, 2024): Ah, never mind... I new saw the modified schema for the `accounts` table in the [beta docs](https://beta.better-auth.com/docs/concepts/database#account)
Author
Owner

@avanderbergh commented on GitHub (Nov 22, 2024):

Reopening...

Now I get this error on: /api/auth/sign-in/social

[Better Auth]  ERROR   Unable to link account The field "scope" does not exist in the "account" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".




 ERROR   unable_to_link_account

I added scope: text() to the account schema and it works.

Is it indented that these new fields are added to the account table? If so, I could do a PR to update the documentation to reflect that.

Also, the CLI generations do not include any of these newly added fields.

<!-- gh-comment-id:2494169219 --> @avanderbergh commented on GitHub (Nov 22, 2024): Reopening... Now I get this error on: `/api/auth/sign-in/social` ``` [Better Auth] ERROR Unable to link account The field "scope" does not exist in the "account" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate". ERROR unable_to_link_account ``` I added `scope: text()` to the `account` schema and it works. Is it indented that these new fields are added to the account table? If so, I could do a PR to update the documentation to reflect that. Also, the CLI generations do not include any of these newly added fields.
Author
Owner

@avanderbergh commented on GitHub (Nov 25, 2024):

OK, I see the docs have already been updated. Closing again... 😄

<!-- gh-comment-id:2497257232 --> @avanderbergh commented on GitHub (Nov 25, 2024): OK, I see the docs have already been updated. Closing again... 😄
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8347