Node.js SQLite experimental warning still appears at runtime despite fix in #4415 #1884

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

Originally created by @iosazee on GitHub (Sep 8, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Steps to Reproduce

  1. Create a new Next.js project with better-auth and PostgreSQL:
    npx create-next-app@latest my-app
    cd my-app
    yarn add better-auth@1.3.8 @prisma/client prisma

  2. Set up better-auth with PostgreSQL adapter:
    // lib/auth.ts
    import { betterAuth } from "better-auth";
    import { prismaAdapter } from "better-auth/adapters/prisma";
    import { PrismaClient } from "@prisma/client";

const db = new PrismaClient();

export const auth = betterAuth({
database: prismaAdapter(db, {
provider: "postgresql",
}),
// ... other config
});

  1. Configure PostgreSQL in .env:
    DATABASE_URL="postgresql://user:password@localhost:5432/mydb"

  2. Run the production build:
    yarn build
    yarn start

  3. Observe the warning in console output:
    (node:66677) ExperimentalWarning: SQLite is an experimental feature
    and might change at any time

  4. To see the full stack trace, run with:
    node --trace-warnings node_modules/.bin/next start

Expected Result: No SQLite warnings when using PostgreSQL adapter

Actual Result: SQLite experimental warning appears even though
PostgreSQL is being used

Environment:

  • Node.js version: v22.17.0
  • better-auth version: 1.3.8
  • Database: PostgreSQL
  • Framework: Next.js 15.5.2
  • OS: macOS (or your OS)

Current vs. Expected behavior

Current Behavior

When using better-auth with PostgreSQL adapter, the application
emits an experimental warning about SQLite at startup:

(node:66677) ExperimentalWarning: SQLite is an experimental feature
and might change at any time
(Use node --trace-warnings ... to show where the warning was
created)

This happens because better-auth dynamically imports node:sqlite
during initialization regardless of which database adapter is
configured. The import occurs in
node_modules/better-auth/dist/shared/better-auth.B8b3lep0.mjs:

if ("createSession" in db && typeof window === "undefined") {
let DatabaseSync = void 0;
try {
({ DatabaseSync } = await import('node:sqlite'));
} catch (error) {
// ...
}
}

Expected Behavior

When using PostgreSQL (or any non-SQLite database adapter):

  • No SQLite module should be imported
  • No SQLite-related warnings should appear in the console
  • The application should start cleanly without experimental warnings

The SQLite module should only be imported when explicitly using the
SQLite adapter, for example:

  • Only when provider: "sqlite" is configured
  • Or when the database instance is actually an SQLite connection

This would prevent unnecessary warnings in production logs and avoid
confusion about which database is actually being used

What version of Better Auth are you using: 1.3.8

{
"system": {
"platform": "darwin",
"arch": "arm64",
"version": "Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:33
PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T8122",
"release": "24.6.0",
"cpuCount": 8,
"cpuModel": "Apple M3",
"totalMemory": "16.00 GB",
"freeMemory": "0.26 GB"
},
"node": {
"version": "v22.17.0",
"env": "development"
},
"packageManager": {
"name": "npm",
"version": "11.5.2"
},
"frameworks": [
{
"name": "next",
"version": "^15.5.2"
},
{
"name": "react",
"version": "^19.1.0"
}
],
"databases": [
{
"name": "@prisma/client",
"version": "6.15.0"
}
],
"betterAuth": {
"version": "0.1.0",
"config": {
"appName": "[REDACTED]",
"baseURL": "[REDACTED]",
"secret": "[REDACTED]",
"database": "prismaAdapter"
}
}
}


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

Backend

### Auth config (if applicable)

```typescript
import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @iosazee on GitHub (Sep 8, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Steps to Reproduce 1. Create a new Next.js project with better-auth and PostgreSQL: npx create-next-app@latest my-app cd my-app yarn add better-auth@1.3.8 @prisma/client prisma 2. Set up better-auth with PostgreSQL adapter: // lib/auth.ts import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { PrismaClient } from "@prisma/client"; const db = new PrismaClient(); export const auth = betterAuth({ database: prismaAdapter(db, { provider: "postgresql", }), // ... other config }); 3. Configure PostgreSQL in .env: DATABASE_URL="postgresql://user:password@localhost:5432/mydb" 4. Run the production build: yarn build yarn start 5. Observe the warning in console output: (node:66677) ExperimentalWarning: SQLite is an experimental feature and might change at any time 6. To see the full stack trace, run with: node --trace-warnings node_modules/.bin/next start Expected Result: No SQLite warnings when using PostgreSQL adapter Actual Result: SQLite experimental warning appears even though PostgreSQL is being used Environment: - Node.js version: v22.17.0 - better-auth version: 1.3.8 - Database: PostgreSQL - Framework: Next.js 15.5.2 - OS: macOS (or your OS) ### Current vs. Expected behavior Current Behavior When using better-auth with PostgreSQL adapter, the application emits an experimental warning about SQLite at startup: (node:66677) ExperimentalWarning: SQLite is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) This happens because better-auth dynamically imports node:sqlite during initialization regardless of which database adapter is configured. The import occurs in node_modules/better-auth/dist/shared/better-auth.B8b3lep0.mjs: if ("createSession" in db && typeof window === "undefined") { let DatabaseSync = void 0; try { ({ DatabaseSync } = await import('node:sqlite')); } catch (error) { // ... } } Expected Behavior When using PostgreSQL (or any non-SQLite database adapter): - No SQLite module should be imported - No SQLite-related warnings should appear in the console - The application should start cleanly without experimental warnings The SQLite module should only be imported when explicitly using the SQLite adapter, for example: - Only when provider: "sqlite" is configured - Or when the database instance is actually an SQLite connection This would prevent unnecessary warnings in production logs and avoid confusion about which database is actually being used ### What version of Better Auth are you using: 1.3.8 { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:33 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T8122", "release": "24.6.0", "cpuCount": 8, "cpuModel": "Apple M3", "totalMemory": "16.00 GB", "freeMemory": "0.26 GB" }, "node": { "version": "v22.17.0", "env": "development" }, "packageManager": { "name": "npm", "version": "11.5.2" }, "frameworks": [ { "name": "next", "version": "^15.5.2" }, { "name": "react", "version": "^19.1.0" } ], "databases": [ { "name": "@prisma/client", "version": "6.15.0" } ], "betterAuth": { "version": "0.1.0", "config": { "appName": "[REDACTED]", "baseURL": "[REDACTED]", "secret": "[REDACTED]", "database": "prismaAdapter" } } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
GiteaMirror added the nextjs label 2026-03-13 09:10:34 -05:00
Author
Owner

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

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

This warning happens because better-auth v1.3.8 imports node:sqlite even when you're using the PostgreSQL adapter. The fix for this issue is not present in 1.3.8, but it is included in 1.3.9-beta.1 and later. Upgrading to at least 1.3.9-beta.1 will prevent the SQLite module from being imported unless you actually use the SQLite adapter, which resolves the warning and avoids confusion in your logs. See this issue for details.

If you can't upgrade right away, there isn't a reliable workaround—disabling features or changing config won't prevent the import or warning, since it's triggered by how the code is bundled and executed. The only robust solution is to update better-auth to a fixed version.

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 8, 2025): <!-- Greeting --> Hi @iosazee! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This warning happens because better-auth v1.3.8 imports `node:sqlite` even when you're using the PostgreSQL adapter. The fix for this issue is not present in 1.3.8, but it is included in 1.3.9-beta.1 and later. Upgrading to at least 1.3.9-beta.1 will prevent the SQLite module from being imported unless you actually use the SQLite adapter, which resolves the warning and avoids confusion in your logs. See [this issue for details](https://github.com/better-auth/better-auth/issues/4450). If you can't upgrade right away, there isn't a reliable workaround—disabling features or changing config won't prevent the import or warning, since it's triggered by how the code is bundled and executed. The only robust solution is to update better-auth to a fixed version. <!-- 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/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0618b3c1-8d5d-4b0e-a495-7f3097ff10fa?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/4524)
Author
Owner

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

Fixed in 1.3.9

@himself65 commented on GitHub (Sep 8, 2025): Fixed in 1.3.9
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1884