[GH-ISSUE #8882] [Bug]: Drizzle adapter + SQLite fails on INSERT — missing supportsBooleans/supportsDates flags #19852

Open
opened 2026-04-15 19:12:22 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @lukemelnik on GitHub (Apr 1, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8882

Originally assigned to: @ping-maxwell on GitHub.

Describe the bug

When using the Drizzle adapter with provider: "sqlite", any INSERT that includes a boolean or Date value fails with:

TypeError: SQLite3 can only bind numbers, strings, bigints, buffers, and null

This affects basic operations like sign-up and sign-in since they insert emailVerified: false and date fields.

Reproduction

import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { drizzle } from "drizzle-orm/better-sqlite3";
import Database from "better-sqlite3";
import * as schema from "./schema";

const sqlite = new Database("test.db");
const db = drizzle(sqlite);

export const auth = betterAuth({
  database: drizzleAdapter(db, {
    provider: "sqlite",
    schema,
  }),
  emailAndPassword: { enabled: true },
});

Attempting to sign up or sign in throws the TypeError above.

Root cause

In packages/drizzle-adapter/src/drizzle-adapter.ts (line ~849), the adapter config sets supportsJSON and supportsArrays to false for non-pg providers, but does not set supportsBooleans or supportsDates:

supportsUUIDs: config.provider === "pg" ? true : false,
supportsJSON: config.provider === "pg" ? true : false,
supportsArrays: config.provider === "pg" ? true : false,

The core adapter factory already handles the conversions when these flags are falsetrue/false1/0 and Date → ISO string — but the Drizzle adapter never sets the flags for SQLite.

Suggested fix

Add two lines alongside the existing flags:

supportsBooleans: config.provider !== "sqlite",
supportsDates: config.provider !== "sqlite",
  • #1460 — same underlying issue, closed with maintainer suggesting the supportsBooleans/supportsDates approach
  • The Kysely adapter (raw better-sqlite3 path) handles this correctly via its own transformation layer

Environment

  • better-auth: 1.5.6
  • @better-auth/drizzle-adapter: 1.5.6
  • drizzle-orm: 0.44.2
  • better-sqlite3: 11.10.0
  • Node.js: 22
Originally created by @lukemelnik on GitHub (Apr 1, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8882 Originally assigned to: @ping-maxwell on GitHub. ## Describe the bug When using the Drizzle adapter with `provider: "sqlite"`, any INSERT that includes a boolean or Date value fails with: ``` TypeError: SQLite3 can only bind numbers, strings, bigints, buffers, and null ``` This affects basic operations like sign-up and sign-in since they insert `emailVerified: false` and date fields. ## Reproduction ```ts import { betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { drizzle } from "drizzle-orm/better-sqlite3"; import Database from "better-sqlite3"; import * as schema from "./schema"; const sqlite = new Database("test.db"); const db = drizzle(sqlite); export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "sqlite", schema, }), emailAndPassword: { enabled: true }, }); ``` Attempting to sign up or sign in throws the TypeError above. ## Root cause In `packages/drizzle-adapter/src/drizzle-adapter.ts` (line ~849), the adapter config sets `supportsJSON` and `supportsArrays` to `false` for non-pg providers, but does not set `supportsBooleans` or `supportsDates`: ```ts supportsUUIDs: config.provider === "pg" ? true : false, supportsJSON: config.provider === "pg" ? true : false, supportsArrays: config.provider === "pg" ? true : false, ``` The core adapter factory already handles the conversions when these flags are `false` — `true`/`false` → `1`/`0` and `Date` → ISO string — but the Drizzle adapter never sets the flags for SQLite. ## Suggested fix Add two lines alongside the existing flags: ```ts supportsBooleans: config.provider !== "sqlite", supportsDates: config.provider !== "sqlite", ``` ## Related - #1460 — same underlying issue, closed with maintainer suggesting the `supportsBooleans`/`supportsDates` approach - The Kysely adapter (raw `better-sqlite3` path) handles this correctly via its own transformation layer ## Environment - `better-auth`: 1.5.6 - `@better-auth/drizzle-adapter`: 1.5.6 - `drizzle-orm`: 0.44.2 - `better-sqlite3`: 11.10.0 - Node.js: 22
GiteaMirror added the databasebug labels 2026-04-15 19:12:22 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 1, 2026):

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

This is a known area that's been actively worked on. The supportsDates gap was reported in #7819 [1] and has gone through several fix iterations:

  • PR #8104 initially added supportsDates: false [2], but that incorrectly transformed incoming date values before writes.
  • PR #8105 replaced it with a customTransformOutput function that converts date fields on read instead [3].
  • PR #8289 further refined this approach [4].

The current adapter (as of the latest main) uses customTransformOutput to handle date conversion rather than setting supportsDates: false directly [5]. However, supportsBooleans does not appear to be explicitly set for SQLite in the Drizzle adapter config [6], which would explain the boolean binding error you're seeing.

If you're on 1.5.6, you may not have the date fixes from those PRs yet depending on when they were released. As a workaround, you could try upgrading to the latest version. For the supportsBooleans gap specifically, your suggested fix (supportsBooleans: config.provider !== "sqlite") looks correct — that flag would let the core adapter factory convert true/false1/0 before the values reach SQLite.

To reply, just mention @dosu.


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

<!-- gh-comment-id:4170558999 --> @dosubot[bot] commented on GitHub (Apr 1, 2026): <!-- Greeting --> Hi @lukemelnik! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a known area that's been actively worked on. The `supportsDates` gap was reported in #7819 [[1]](https://github.com/better-auth/better-auth/issues/7819) and has gone through several fix iterations: - **PR #8104** initially added `supportsDates: false` [[2]](https://github.com/better-auth/better-auth/pull/8104), but that incorrectly transformed *incoming* date values before writes. - **PR #8105** replaced it with a `customTransformOutput` function that converts date fields on *read* instead [[3]](https://github.com/better-auth/better-auth/pull/8105). - **PR #8289** further refined this approach [[4]](https://github.com/better-auth/better-auth/pull/8289). The current adapter (as of the latest `main`) uses `customTransformOutput` to handle date conversion rather than setting `supportsDates: false` directly [[5]](https://github.com/better-auth/better-auth/blob/920f5052def89cfce273f8c3105cdf4cc5ab5c9b/packages/drizzle-adapter/src/drizzle-adapter.ts#L855-L865). However, `supportsBooleans` does **not** appear to be explicitly set for SQLite in the Drizzle adapter config [[6]](https://github.com/better-auth/better-auth/blob/920f5052def89cfce273f8c3105cdf4cc5ab5c9b/packages/drizzle-adapter/src/drizzle-adapter.ts#L843-L879), which would explain the boolean binding error you're seeing. If you're on `1.5.6`, you may not have the date fixes from those PRs yet depending on when they were released. As a workaround, you could try upgrading to the latest version. For the `supportsBooleans` gap specifically, your suggested fix (`supportsBooleans: config.provider !== "sqlite"`) looks correct — that flag would let the core adapter factory convert `true`/`false` → `1`/`0` before the values reach SQLite. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=00827fe8-0fde-471b-9edb-29a93242a91c&feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20area%20that%27s%20been%20actively%20worked%20on.%20The%20%60supportsDates%60%20gap%20was%20reported%20in%20%237819%20%5B%5B1%5D%5D%28https%3A//github.com/better-auth/better-auth/issues/7819%29%20and%20has%20gone%20through%20several%20fix%20iterations%3A%0A%0A-%20%2A%2APR%20%238104%2A%2A%20initially%20added%20%60supportsDates%3A%20false%60%20%5B%5B2%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/8104%29%2C%20but%20that%20incorrectly%20transformed%20%2Aincoming%2A%20date%20values%20before%20writes.%0A-%20%2A%2APR%20%238105%2A%2A%20replaced%20it%20with%20a%20%60customTransformOutput%60%20function%20that%20converts%20date%20fields%20on%20%2Aread%2A%20instead%20%5B%5B3%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/8105%29.%0A-%20%2A%2APR%20%238289%2A%2A%20further%20refined%20this%20approach%20%5B%5B4%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/8289%29.%0A%0AThe%20current%20adapter%20%28as%20of%20the%20latest%20%60main%60%29%20uses%20%60customTransformOutput%60%20to%20handle%20date%20conversion%20rather%20than%20setting%20%60supportsDates%3A%20false%60%20directly%20%5B%5B5%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/920f5052def89cfce273f8c3105cdf4cc5ab5c9b/packages/drizzle-adapter/src/drizzle-adapter.ts%23L855-L865%29.%20However%2C%20%60supportsBooleans%60%20does%20%2A%2Anot%2A%2A%20appear%20to%20be%20explicitly%20set%20for%20SQLite%20in%20the%20Drizzle%20adapter%20config%20%5B%5B6%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/920f5052def89cfce273f8c3105cdf4cc5ab5c9b/packages/drizzle-adapter/src/drizzle-adapter.ts%23L843-L879%29%2C%20which%20would%20explain%20the%20boolean%20binding%20error%20you%27re%20seeing.%0A%0AIf%20you%27re%20on%20%601.5.6%60%2C%20you%20may%20not%20have%20the%20date%20fixes%20from%20those%20PRs%20yet%20depending%20on%20when%20they%20were%20released.%20As%20a%20workaround%2C%20you%20could%20try%20upgrading%20to%20the%20latest%20version.%20For%20the%20%60supportsBooleans%60%20gap%20specifically%2C%20your%20suggested%20fix%20%28%60supportsBooleans%3A%20config.provider%20%21%3D%3D%20%22sqlite%22%60%29%20looks%20correct%20%E2%80%94%20that%20flag%20would%20let%20the%20core%20adapter%20factory%20convert%20%60true%60/%60false%60%20%E2%86%92%20%601%60/%600%60%20before%20the%20values%20reach%20SQLite.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&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/8882)
Author
Owner

@stewartjarod commented on GitHub (Apr 1, 2026):

Seems like the supportsBooleans: config.provider !== "sqlite", would be a good add.
I think the Kysley adapter already does this for sqlite.

<!-- gh-comment-id:4171533606 --> @stewartjarod commented on GitHub (Apr 1, 2026): Seems like the `supportsBooleans: config.provider !== "sqlite",` would be a good add. I think the Kysley adapter already does this for sqlite.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19852