Unhandled scheme error with node:sqlite #1847

Closed
opened 2026-03-13 09:07:54 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @steeeee0223 on GitHub (Sep 5, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Install Nodejs (22.10) with pnpm (≥10)
  2. Setup Nextjs (≥15.3) with better-auth 1.3.8
  3. Choose database adapter: drizzle-orm
  4. Run pnpm build

Current vs. Expected behavior

Image

What version of Better Auth are you using?

1.3.8

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:29:54 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8122",
    "release": "24.6.0",
    "cpuCount": 8,
    "cpuModel": "Apple M3",
    "totalMemory": "8.00 GB",
    "freeMemory": "0.09 GB"
  },
  "node": {
    "version": "v22.10.0",
    "env": "development"
  },
  "packageManager": {
    "name": "pnpm",
    "version": "10.4.1"
  },

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
  },
});

Additional context

I'm curious that i'm not even using sqlite, but encountered this error

Image
Originally created by @steeeee0223 on GitHub (Sep 5, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Install Nodejs (22.10) with pnpm (≥10) 2. Setup Nextjs (≥15.3) with better-auth 1.3.8 3. Choose database adapter: `drizzle-orm` 4. Run `pnpm build` ### Current vs. Expected behavior <img width="606" height="103" alt="Image" src="https://github.com/user-attachments/assets/4526b468-e0ff-422c-8c9f-122c00e522eb" /> ### What version of Better Auth are you using? 1.3.8 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:29:54 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8122", "release": "24.6.0", "cpuCount": 8, "cpuModel": "Apple M3", "totalMemory": "8.00 GB", "freeMemory": "0.09 GB" }, "node": { "version": "v22.10.0", "env": "development" }, "packageManager": { "name": "pnpm", "version": "10.4.1" }, ``` ### 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 }, }); ``` ### Additional context I'm curious that i'm not even using sqlite, but encountered this error <img width="606" height="103" alt="Image" src="https://github.com/user-attachments/assets/4526b468-e0ff-422c-8c9f-122c00e522eb" />
GiteaMirror added the nextjs label 2026-03-13 09:07:54 -05:00
Author
Owner

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

This error is likely caused by implicit references to SQLite in the drizzle adapter's dialect detection logic. Even if you don't explicitly use SQLite, the adapter or drizzle-orm may infer it based on your configuration or the shape of your database object, which can trigger attempts to load the node:sqlite driver. If your environment or build toolchain (like Webpack in Next.js) doesn't support the node: scheme, you'll see this error source.

To avoid this, make sure your database adapter configuration explicitly sets the correct provider (e.g., 'pg' for Postgres, 'mysql' for MySQL) and that your connection string or database object matches your intended backend. Also, keep all database and auth configuration strictly in server-side files—never import them in client-side components or pages, as this can surface module resolution errors during bundling source.

If you are not using SQLite, double-check that neither your adapter nor any schema generation logic defaults to or infers 'sqlite'. If you still see the error, review your imports and ensure that nothing in your build references SQLite or the node:sqlite scheme source.

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 (Sep 5, 2025): <!-- Answer --> This error is likely caused by implicit references to SQLite in the drizzle adapter's dialect detection logic. Even if you don't explicitly use SQLite, the adapter or drizzle-orm may infer it based on your configuration or the shape of your database object, which can trigger attempts to load the `node:sqlite` driver. If your environment or build toolchain (like Webpack in Next.js) doesn't support the `node:` scheme, you'll see this error [source](https://github.com/better-auth/better-auth/pull/3869). To avoid this, make sure your database adapter configuration explicitly sets the correct provider (e.g., `'pg'` for Postgres, `'mysql'` for MySQL) and that your connection string or database object matches your intended backend. Also, keep all database and auth configuration strictly in server-side files—never import them in client-side components or pages, as this can surface module resolution errors during bundling [source](https://github.com/better-auth/better-auth/issues/3136). If you are not using SQLite, double-check that neither your adapter nor any schema generation logic defaults to or infers `'sqlite'`. If you still see the error, review your imports and ensure that nothing in your build references SQLite or the `node:sqlite` scheme [source](https://github.com/better-auth/better-auth/pull/4400). <!-- 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/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b6fa0207-e927-4b8f-9c16-421eb3286a6c?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/4450)
Author
Owner

@himself65 commented on GitHub (Sep 5, 2025):

Can you try v1.3.9-beta.1?

@himself65 commented on GitHub (Sep 5, 2025): Can you try `v1.3.9-beta.1`?
Author
Owner

@steeeee0223 commented on GitHub (Sep 5, 2025):

@himself65 v1.3.9-beta.1 worked

@steeeee0223 commented on GitHub (Sep 5, 2025): @himself65 `v1.3.9-beta.1` worked
Author
Owner

@himself65 commented on GitHub (Sep 5, 2025):

14ad4347c0

@himself65 commented on GitHub (Sep 5, 2025): https://github.com/better-auth/better-auth/commit/14ad4347c07454ea419005b48777e67d9d1e1740
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1847