[GH-ISSUE #4781] Verification table blank? #10063

Closed
opened 2026-04-13 05:58:29 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @cory-mosey on GitHub (Sep 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4781

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

N/A

Current vs. Expected behavior

I've generated the schema using Better Auth CLI and migrated into my Postgres database (NeonDB) - However, whenever a user signs up or/and forces email verification from the client, it never goes into the database?

We can confirm an email sends and a token can validate the users email, however, why is this not going into the database?

What version of Better Auth are you using?

1.3.12

System info

N/A

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

Backend

Auth config (if applicable)

betterAuth({
    secret: '...',
    basePath: '/auth/api',
    database: drizzleAdapter(db, {
        provider: "pg",
        schema: {
            user: Schema.user,
            account: Schema.account,
            session: Schema.session,
            verification: Schema.verification
        }
    }),
    emailAndPassword: {
        enabled: true,
        requireEmailVerification: true
    },
    emailVerification: {
        sendOnSignUp: true,
        sendVerificationEmail: async({ user, url, token }, request) => {
            await Email.send({
                to: user.email,
                from: 'no-reply',
                subject: 'Verify your email',
                body: `Click <a href="${url}">here</a> to verify your email`
            })
        }
    },
    plugins: [ bearer() ]
});

Additional context

No response

Originally created by @cory-mosey on GitHub (Sep 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4781 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce N/A ### Current vs. Expected behavior I've generated the schema using Better Auth CLI and migrated into my Postgres database (NeonDB) - However, whenever a user signs up or/and forces email verification from the client, it never goes into the database? We can confirm an email sends and a token can validate the users email, however, why is this not going into the database? ### What version of Better Auth are you using? 1.3.12 ### System info ```bash N/A ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript betterAuth({ secret: '...', basePath: '/auth/api', database: drizzleAdapter(db, { provider: "pg", schema: { user: Schema.user, account: Schema.account, session: Schema.session, verification: Schema.verification } }), emailAndPassword: { enabled: true, requireEmailVerification: true }, emailVerification: { sendOnSignUp: true, sendVerificationEmail: async({ user, url, token }, request) => { await Email.send({ to: user.email, from: 'no-reply', subject: 'Verify your email', body: `Click <a href="${url}">here</a> to verify your email` }) } }, plugins: [ bearer() ] }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 05:58:29 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 20, 2025):

Hi @cory-mosey! I'm Dosu and I’m helping the better-auth team.

The most likely reason your verification table is blank is a schema mapping issue between Better Auth and your database. With the Drizzle adapter, you need to ensure that the field names and table names in your Better Auth config exactly match those in your database schema. If you customized any names during CLI generation, you must map them explicitly in your drizzleAdapter config—for example, if your table is named custom_verification instead of verification, or if any fields differ in name, you need to specify those mappings like this.

Recent fixes in Better Auth improved schema generation and naming conventions for Drizzle, so double-check that your CLI-generated schema and your adapter config are aligned, including pluralization and snake_case conversion for table/field names see details and here.

If the schema is correct, but records still aren't inserted, enable debug logging in your adapter config to trace database operations and catch any silent validation or transformation errors during record creation. The verification table expects fields like id, identifier, value, expiresAt, createdAt, and updatedAt to be present and correctly mapped reference.

In short: check your schema mappings, table/field names, and enable debug logs to pinpoint where the insertion is failing. If you spot any mismatches or missing fields, update your config to match your database schema.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3314863346 --> @dosubot[bot] commented on GitHub (Sep 20, 2025): <!-- Greeting --> Hi @cory-mosey! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The most likely reason your verification table is blank is a schema mapping issue between Better Auth and your database. With the Drizzle adapter, you need to ensure that the field names and table names in your Better Auth config exactly match those in your database schema. If you customized any names during CLI generation, you must map them explicitly in your drizzleAdapter config—for example, if your table is named `custom_verification` instead of `verification`, or if any fields differ in name, you need to specify those mappings [like this](https://github.com/better-auth/better-auth/issues/4434). Recent fixes in Better Auth improved schema generation and naming conventions for Drizzle, so double-check that your CLI-generated schema and your adapter config are aligned, including pluralization and snake_case conversion for table/field names [see details](https://github.com/better-auth/better-auth/pull/4400) [and here](https://github.com/better-auth/better-auth/pull/4132). If the schema is correct, but records still aren't inserted, enable debug logging in your adapter config to trace database operations and catch any silent validation or transformation errors during record creation. The verification table expects fields like `id`, `identifier`, `value`, `expiresAt`, `createdAt`, and `updatedAt` to be present and correctly mapped [reference](https://github.com/better-auth/better-auth/blob/57510365a393bca2f6a37e50c43571651b121978/packages/better-auth/src/db/schema.ts). In short: check your schema mappings, table/field names, and enable debug logs to pinpoint where the insertion is failing. If you spot any mismatches or missing fields, update your config to match your database schema. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8593b483-5331-4d3e-940c-1fc22bad0e46?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4781)
Author
Owner

@cory-mosey commented on GitHub (Sep 20, 2025):

Hi @dosu

This is a recent install of Better-Auth (1 day ago) as per the version.

I've have not made any changes to the schema from the default CLI generation, please see below:

export const verification = pgTable("verification", {
  id: text("id").primaryKey(),
  identifier: text("identifier").notNull(),
  value: text("value").notNull(),
  expiresAt: timestamp("expires_at").notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
  updatedAt: timestamp("updated_at")
    .defaultNow()
    .$onUpdate(() => /* @__PURE__ */ new Date())
    .notNull(),
});
<!-- gh-comment-id:3314866102 --> @cory-mosey commented on GitHub (Sep 20, 2025): Hi @dosu This is a recent install of Better-Auth (1 day ago) as per the version. I've have not made any changes to the schema from the default CLI generation, please see below: ``` export const verification = pgTable("verification", { id: text("id").primaryKey(), identifier: text("identifier").notNull(), value: text("value").notNull(), expiresAt: timestamp("expires_at").notNull(), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at") .defaultNow() .$onUpdate(() => /* @__PURE__ */ new Date()) .notNull(), }); ```
Author
Owner

@dvanmali commented on GitHub (Sep 24, 2025):

Closing as not an issue

<!-- gh-comment-id:3330572612 --> @dvanmali commented on GitHub (Sep 24, 2025): Closing as not an issue
Author
Owner

@snibbo71 commented on GitHub (Oct 27, 2025):

I'm curious as to why this is not an issue? I'm seeing the same thing with Prisma, with BetterAuth having created the schema - and the schema matching exactly what's on the BetterAuth docs. Yet my verification table remains blank too.

I'm also having an issue where I cannot re-send verification e-mails to people who've never received it (or it's expired) because BetterAuth bounces the clientAuth.sendVerificationEmail with YOU_CAN_ONLY_SEND_A_VERIFICATION_EMAIL_TO_AN_UNVERIFIED_EMAIL

Except that in the user table email_verified is 0 so it's not been verified.

This then requires manual intervention to straighten out where a simple button to 'resend validation email' would work.

I'm not sure if the lack of entries in the verification table is what's causing the above error but I suspect maybe it is?

<!-- gh-comment-id:3450950538 --> @snibbo71 commented on GitHub (Oct 27, 2025): I'm curious as to why this is not an issue? I'm seeing the same thing with Prisma, with BetterAuth having created the schema - and the schema matching exactly what's on the BetterAuth docs. Yet my verification table remains blank too. I'm also having an issue where I cannot re-send verification e-mails to people who've never received it (or it's expired) because BetterAuth bounces the clientAuth.sendVerificationEmail with YOU_CAN_ONLY_SEND_A_VERIFICATION_EMAIL_TO_AN_UNVERIFIED_EMAIL Except that in the user table email_verified is 0 so it's not been verified. This then requires manual intervention to straighten out where a simple button to 'resend validation email' would work. I'm not sure if the lack of entries in the verification table is what's causing the above error but I suspect maybe it is?
Author
Owner

@snibbo71 commented on GitHub (Oct 27, 2025):

Never mind - I should have looked at the code. I'd misunderstood how it works...

You can't resend a verification email as an admin of the site because BetterAuth looks for session?.user?.verifiedEmail which is set to true if you're logged as the site admin :)

But resending does work if you're not logged in and the address hasn't been verified. So my apologies - it's working as intended!

<!-- gh-comment-id:3451001511 --> @snibbo71 commented on GitHub (Oct 27, 2025): Never mind - I should have looked at the code. I'd misunderstood how it works... You can't resend a verification email as an admin of the site because BetterAuth looks for session?.user?.verifiedEmail which is set to true if you're logged as the site admin :) But resending does work if you're not logged in and the address hasn't been verified. So my apologies - it's working as intended!
Author
Owner

@joaovpmamede commented on GitHub (Nov 21, 2025):

I'm not sure but I think it'll only add to the verification table if you forget/reset your password.

<!-- gh-comment-id:3564403477 --> @joaovpmamede commented on GitHub (Nov 21, 2025): I'm not sure but I think it'll only add to the verification table if you forget/reset your password.
Author
Owner

@pavantamidala commented on GitHub (Nov 24, 2025):

I'm not sure but I think it'll only add to the verification table if you forget/reset your password.

Yeah i am also seeing this.

Verification table is not being used for email verification process. Can anyone from the team please confirm this?

<!-- gh-comment-id:3571419058 --> @pavantamidala commented on GitHub (Nov 24, 2025): > I'm not sure but I think it'll only add to the verification table if you forget/reset your password. Yeah i am also seeing this. Verification table is not being used for email verification process. Can anyone from the team please confirm this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10063