Issue: verification fields not overriding in phoneNumber plugin #2090

Closed
opened 2026-03-13 09:26:12 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jjjrmy on GitHub (Oct 8, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Setup BetterAuth with below Config
  2. Make migrations here verifications table has created_at and updated_at columns
  3. Do a verification with phoneNumber plugin

Current vs. Expected behavior

ERROR [Better Auth]: select * from verifications where identifier = '+1XXX' order by createdAt desc limit 1 - D1_ERROR: no such column: createdAt at offset 62: SQLITE_ERROR

What version of Better Auth are you using?

1.3.11

System info

n/a

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

Package

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
  verification: {
    modelName: "verifications",
    fields: {
        expiresAt: "expires_at",
        createdAt: "created_at",
        updatedAt: "updated_at",
    },
  },
});

Additional context

No response

Originally created by @jjjrmy on GitHub (Oct 8, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Setup BetterAuth with below Config 2. Make migrations here `verifications` table has `created_at` and `updated_at` columns 3. Do a verification with phoneNumber plugin ### Current vs. Expected behavior ``` ERROR [Better Auth]: select * from verifications where identifier = '+1XXX' order by createdAt desc limit 1 - D1_ERROR: no such column: createdAt at offset 62: SQLITE_ERROR ``` ### What version of Better Auth are you using? 1.3.11 ### System info ```bash n/a ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, verification: { modelName: "verifications", fields: { expiresAt: "expires_at", createdAt: "created_at", updatedAt: "updated_at", }, }, }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 09:26:12 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 8, 2025):

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

This is a known limitation in BetterAuth v1.3.11: the phoneNumber plugin hardcodes field names like createdAt and does not use the custom field mappings from your verification config, which causes the SQL error when your database uses snake_case columns like created_at see source.

There’s currently no built-in workaround to override these field names in the plugin. A similar field mapping issue was recently fixed for other fields (like refreshTokenExpiresAt), but not yet for verification fields in the phoneNumber plugin see PR. There’s also an open PR to improve field mapping in adapters, but it’s not merged yet see PR.

For now, you’d need to either patch the plugin locally to use your mapped field names or temporarily rename your DB columns to match what the plugin expects. Keep an eye on future releases for a proper fix, as this pattern is being addressed elsewhere in the codebase.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Oct 8, 2025): <!-- Greeting --> Hi @jjjrmy! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a known limitation in BetterAuth v1.3.11: the phoneNumber plugin hardcodes field names like `createdAt` and does not use the custom field mappings from your verification config, which causes the SQL error when your database uses snake_case columns like `created_at` [see source](https://github.com/better-auth/better-auth/blob/9b1c5d885d16c5101c089f09cce13f1da64dac0b/packages/better-auth/src/plugins/phone-number/index.ts). There’s currently no built-in workaround to override these field names in the plugin. A similar field mapping issue was recently fixed for other fields (like `refreshTokenExpiresAt`), but not yet for verification fields in the phoneNumber plugin [see PR](https://github.com/better-auth/better-auth/pull/4569). There’s also an open PR to improve field mapping in adapters, but it’s not merged yet [see PR](https://github.com/better-auth/better-auth/pull/4265). For now, you’d need to either patch the plugin locally to use your mapped field names or temporarily rename your DB columns to match what the plugin expects. Keep an eye on future releases for a proper fix, as this pattern is being addressed elsewhere in the codebase. <!-- 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/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fd08a867-93f6-4487-9484-7f2fc20803f6?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/5157)
Author
Owner

@jjjrmy commented on GitHub (Oct 8, 2025):

nvm, this was an adapter issue I guess

@jjjrmy commented on GitHub (Oct 8, 2025): nvm, this was an adapter issue I guess
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2090