TypeError: this.client.prepare is not a function #2888

Closed
opened 2026-03-13 10:25:46 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jonaspm on GitHub (Feb 17, 2026).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Use deps:

  • drizzle-orm@beta
  • @tursodatabase/serverless@latest

Current vs. Expected behavior

I expected BetterAuth to be compatible with drizzle 1.0.0-beta but it is not.

What version of Better Auth are you using?

1.4.18

System info

Bun v1.3.9
Node v24.13.0
npm v11.6.2
Windows 11 x64

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

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth/minimal";
import { drizzleAdapter } from 'better-auth/adapters/drizzle';

export const auth = betterAuth({
    database: drizzleAdapter(db, {
        provider: 'sqlite',
        schema: {
            user: user,
            session: session,
            account: account,
            verification: verification,
        }
    }),
    // ...
});

Additional context

2026-02-17T21:38:28.321Z ERROR [Better Auth]: TypeError TypeError: this.client.prepare is not a function
Originally created by @jonaspm on GitHub (Feb 17, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Use deps: - drizzle-orm@beta - @tursodatabase/serverless@latest ### Current vs. Expected behavior I expected BetterAuth to be compatible with drizzle 1.0.0-beta but it is not. ### What version of Better Auth are you using? 1.4.18 ### System info ```bash Bun v1.3.9 Node v24.13.0 npm v11.6.2 Windows 11 x64 ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth/minimal"; import { drizzleAdapter } from 'better-auth/adapters/drizzle'; export const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'sqlite', schema: { user: user, session: session, account: account, verification: verification, } }), // ... }); ``` ### Additional context ```bash 2026-02-17T21:38:28.321Z ERROR [Better Auth]: TypeError TypeError: this.client.prepare is not a function ```
GiteaMirror added the bug label 2026-03-13 10:25:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 17, 2026):

This error is caused by Drizzle ORM v1.0.0-beta not being officially supported by Better Auth yet. Better Auth currently supports drizzle-orm >=0.41.0 (stable versions).

There's an open issue tracking Drizzle v1.0.0 compatibility and a PR #6913 in progress to add support.

Workarounds:

  1. Downgrade to stable Drizzle (recommended): Use drizzle-orm@0.41.0 or later stable version instead of the beta.

  2. Test the PR fix before release:

    npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/drizzle-adapter@6913
    

    Then use the new import:

    import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2";
    
  3. Manual schema merging (if you must stay on beta): Pass your schema to both the drizzle() constructor and the adapter:

    import * as schema from "./schema";
    
    export const db = drizzle({
      connection: process.env.DATABASE_URL!,
      schema,
    });
    
    export const auth = betterAuth({
      database: drizzleAdapter(db, {
        provider: 'sqlite',
        schema,
      }),
    });
    

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

@dosubot[bot] commented on GitHub (Feb 17, 2026): <!-- Answer --> This error is caused by **Drizzle ORM v1.0.0-beta not being officially supported** by Better Auth yet. Better Auth currently supports [drizzle-orm >=0.41.0 (stable versions)](https://github.com/better-auth/better-auth/blob/d3b579e42a707a9037a9210ad14611366b745d2a/packages/better-auth/package.json#L512). There's an [open issue tracking Drizzle v1.0.0 compatibility](https://github.com/better-auth/better-auth/issues/6766) and a [PR #6913](https://github.com/better-auth/better-auth/pull/6913) in progress to add support. **Workarounds:** 1. **Downgrade to stable Drizzle** (recommended): Use `drizzle-orm@0.41.0` or later stable version instead of the beta. 2. **Test the PR fix** before release: ```bash npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/drizzle-adapter@6913 ``` Then use the new import: ```typescript import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2"; ``` 3. **Manual schema merging** (if you must stay on beta): Pass your schema to both the `drizzle()` constructor and the adapter: ```typescript import * as schema from "./schema"; export const db = drizzle({ connection: process.env.DATABASE_URL!, schema, }); export const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'sqlite', 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/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/54758084-2e84-4ed2-92bd-22f190bf99a3?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)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20error%20is%20caused%20by%20%2A%2ADrizzle%20ORM%20v1.0.0-beta%20not%20being%20officially%20supported%2A%2A%20by%20Better%20Auth%20yet.%20Better%20Auth%20currently%20supports%20%5Bdrizzle-orm%20%3E%3D0.41.0%20%28stable%20versions%29%5D%28https%3A//github.com/better-auth/better-auth/blob/d3b579e42a707a9037a9210ad14611366b745d2a/packages/better-auth/package.json%23L512%29.%0A%0AThere%27s%20an%20%5Bopen%20issue%20tracking%20Drizzle%20v1.0.0%20compatibility%5D%28https%3A//github.com/better-auth/better-auth/issues/6766%29%20and%20a%20%5BPR%20%236913%5D%28https%3A//github.com/better-auth/better-auth/pull/6913%29%20in%20progress%20to%20add%20support.%0A%0A%2A%2AWorkarounds%3A%2A%2A%0A%0A1.%20%2A%2ADowngrade%20to%20stable%20Drizzle%2A%2A%20%28recommended%29%3A%20Use%20%60drizzle-orm%400.41.0%60%20or%20later%20stable%20version%20instead%20of%20the%20beta.%0A%0A2.%20%2A%2ATest%20the%20PR%20fix%2A%2A%20before%20release%3A%0A%20%20%20%60%60%60bash%0A%20%20%20npm%20i%20https%3A//pkg.pr.new/better-auth/better-auth/%40better-auth/drizzle-adapter%406913%0A%20%20%20%60%60%60%0A%20%20%20Then%20use%20the%20new%20import%3A%0A%20%20%20%60%60%60typescript%0A%20%20%20import%20%7B%20drizzleAdapter%20%7D%20from%20%22%40better-auth/drizzle-adapter/relations-v2%22%3B%0A%20%20%20%60%60%60%0A%0A3.%20%2A%2AManual%20schema%20merging%2A%2A%20%28if%20you%20must%20stay%20on%20beta%29%3A%20Pass%20your%20schema%20to%20both%20the%20%60drizzle%28%29%60%20constructor%20and%20the%20adapter%3A%0A%20%20%20%60%60%60typescript%0A%20%20%20import%20%2A%20as%20schema%20from%20%22./schema%22%3B%0A%20%20%20%0A%20%20%20export%20const%20db%20%3D%20drizzle%28%7B%0A%20%20%20%20%20connection%3A%20process.env.DATABASE_URL%21%2C%0A%20%20%20%20%20schema%2C%0A%20%20%20%7D%29%3B%0A%20%20%20%0A%20%20%20export%20const%20auth%20%3D%20betterAuth%28%7B%0A%20%20%20%20%20database%3A%20drizzleAdapter%28db%2C%20%7B%0A%20%20%20%20%20%20%20provider%3A%20%27sqlite%27%2C%0A%20%20%20%20%20%20%20schema%2C%0A%20%20%20%20%20%7D%29%2C%0A%20%20%20%7D%29%3B%0A%20%20%20%60%60%60)&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/8028)
Author
Owner

@jonaspm commented on GitHub (Feb 17, 2026):

closing as this is already work in progress
.

@jonaspm commented on GitHub (Feb 17, 2026): closing as this is already work in progress .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2888