[GH-ISSUE #8330] All adapters get installed because they are in dependencies #28380

Closed
opened 2026-04-17 19:49:24 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @leon on GitHub (Mar 3, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8330

Is this suited for github?

  • [ x ] Yes, this is suited for github

To Reproduce

Install 1.5.1

It will pull down all adapters

I think it's because the adapters are in dependencies, but should be in optionalDependencies?

"dependencies": {
    "@better-auth/utils": "0.3.1",
    "@better-fetch/fetch": "1.1.21",
    "@noble/ciphers": "^2.1.1",
    "@noble/hashes": "^2.0.1",
    "better-call": "1.3.2",
    "defu": "^6.1.4",
    "jose": "^6.1.3",
    "kysely": "^0.28.11",
    "nanostores": "^1.1.1",
    "zod": "^4.3.6",
    "@better-auth/core": "1.5.1",
    "@better-auth/drizzle-adapter": "1.5.1",
    "@better-auth/memory-adapter": "1.5.1",
    "@better-auth/kysely-adapter": "1.5.1",
    "@better-auth/mongo-adapter": "1.5.1",
    "@better-auth/prisma-adapter": "1.5.1",
    "@better-auth/telemetry": "1.5.1"
  },

Current vs. Expected behavior

in better-auth 1.4.19 it does not install amongst other the prisma package.
in better-auth 1.5.1 pnpm was asking to do the pnpm approve-build for prisma, but I was not using prisma in that project.

so i want to pick which adapter I want and only have it install those dependencies :)

What version of Better Auth are you using?

1.5.1

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020",
    "release": "25.3.0",
    "cpuCount": 12,
    "cpuModel": "Apple M2 Max",
    "totalMemory": "32.00 GB",
    "freeMemory": "0.72 GB"
  },
  "node": {
    "version": "v24.11.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.6.2"
  },
  "frameworks": [
    {
      "name": "svelte",
      "version": "5.53.6"
    },
    {
      "name": "@sveltejs/kit",
      "version": "2.53.4"
    }
  ],
  "databases": null,
  "betterAuth": {
    "version": "1.4.19",
    "config": {
      "baseURL": "http://localhost:5183",
      "advanced": {
        "useSecureCookies": false
      },
      "session": {
        "cookieCache": {
          "enabled": true,
          "maxAge": 604800,
          "strategy": "jwt",
          "refreshCache": true
        }
      },
      "account": {
        "storeStateStrategy": "cookie",
        "storeAccountCookie": true
      },
      "plugins": [
        {
          "name": "handoff",
          "config": {
            "id": "handoff",
            "endpoints": {}
          }
        },
        {
          "name": "auth0",
          "config": {
            "id": "auth0",
            "endpoints": {}
          }
        },
        {
          "name": "sveltekit-cookies",
          "config": {
            "id": "sveltekit-cookies",
            "hooks": {
              "after": [
                {}
              ]
            }
          }
        }
      ],
      "secret": "[REDACTED]"
    }
  }

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

No response

Originally created by @leon on GitHub (Mar 3, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8330 ### Is this suited for github? - [ x ] Yes, this is suited for github ### To Reproduce Install 1.5.1 It will pull down all adapters I think it's because the adapters are in dependencies, but should be in optionalDependencies? ``` "dependencies": { "@better-auth/utils": "0.3.1", "@better-fetch/fetch": "1.1.21", "@noble/ciphers": "^2.1.1", "@noble/hashes": "^2.0.1", "better-call": "1.3.2", "defu": "^6.1.4", "jose": "^6.1.3", "kysely": "^0.28.11", "nanostores": "^1.1.1", "zod": "^4.3.6", "@better-auth/core": "1.5.1", "@better-auth/drizzle-adapter": "1.5.1", "@better-auth/memory-adapter": "1.5.1", "@better-auth/kysely-adapter": "1.5.1", "@better-auth/mongo-adapter": "1.5.1", "@better-auth/prisma-adapter": "1.5.1", "@better-auth/telemetry": "1.5.1" }, ``` ### Current vs. Expected behavior in better-auth 1.4.19 it does not install amongst other the prisma package. in better-auth 1.5.1 pnpm was asking to do the pnpm approve-build for prisma, but I was not using prisma in that project. so i want to pick which adapter I want and only have it install those dependencies :) ### What version of Better Auth are you using? 1.5.1 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020", "release": "25.3.0", "cpuCount": 12, "cpuModel": "Apple M2 Max", "totalMemory": "32.00 GB", "freeMemory": "0.72 GB" }, "node": { "version": "v24.11.1", "env": "development" }, "packageManager": { "name": "npm", "version": "11.6.2" }, "frameworks": [ { "name": "svelte", "version": "5.53.6" }, { "name": "@sveltejs/kit", "version": "2.53.4" } ], "databases": null, "betterAuth": { "version": "1.4.19", "config": { "baseURL": "http://localhost:5183", "advanced": { "useSecureCookies": false }, "session": { "cookieCache": { "enabled": true, "maxAge": 604800, "strategy": "jwt", "refreshCache": true } }, "account": { "storeStateStrategy": "cookie", "storeAccountCookie": true }, "plugins": [ { "name": "handoff", "config": { "id": "handoff", "endpoints": {} } }, { "name": "auth0", "config": { "id": "auth0", "endpoints": {} } }, { "name": "sveltekit-cookies", "config": { "id": "sveltekit-cookies", "hooks": { "after": [ {} ] } } } ], "secret": "[REDACTED]" } } ``` ### 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 _No response_
GiteaMirror added the locked label 2026-04-17 19:49:24 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 3, 2026):

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

Good news — this has already been addressed! PR #8303 was merged today and moves the adapter packages (@better-auth/drizzle-adapter, @better-auth/mongo-adapter, @better-auth/prisma-adapter) from dependencies to optional peer dependencies.

Only kysely-adapter and memory-adapter remain as regular dependencies since they're used in core runtime code.

This fix should be available in the next release. In the meantime, you can import directly from the dedicated adapter package you need (e.g., @better-auth/drizzle-adapter) for better tree-shaking.

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:3990065041 --> @dosubot[bot] commented on GitHub (Mar 3, 2026): <!-- Greeting --> Hi @leon! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> Good news — this has already been addressed! [PR #8303](https://github.com/better-auth/better-auth/pull/8303) was merged today and moves the adapter packages (`@better-auth/drizzle-adapter`, `@better-auth/mongo-adapter`, `@better-auth/prisma-adapter`) from `dependencies` to **optional peer dependencies**. Only `kysely-adapter` and `memory-adapter` remain as regular dependencies since they're used in core runtime code. This fix should be available in the next release. In the meantime, you can import directly from the dedicated adapter package you need (e.g., `@better-auth/drizzle-adapter`) for better tree-shaking. <!-- 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/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1a2f2c82-d697-4466-a432-b04b84c138d0?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=Good%20news%20%E2%80%94%20this%20has%20already%20been%20addressed%21%20%5BPR%20%238303%5D%28https%3A//github.com/better-auth/better-auth/pull/8303%29%20was%20merged%20today%20and%20moves%20the%20adapter%20packages%20%28%60%40better-auth/drizzle-adapter%60%2C%20%60%40better-auth/mongo-adapter%60%2C%20%60%40better-auth/prisma-adapter%60%29%20from%20%60dependencies%60%20to%20%2A%2Aoptional%20peer%20dependencies%2A%2A.%0A%0AOnly%20%60kysely-adapter%60%20and%20%60memory-adapter%60%20remain%20as%20regular%20dependencies%20since%20they%27re%20used%20in%20core%20runtime%20code.%0A%0AThis%20fix%20should%20be%20available%20in%20the%20next%20release.%20In%20the%20meantime%2C%20you%20can%20import%20directly%20from%20the%20dedicated%20adapter%20package%20you%20need%20%28e.g.%2C%20%60%40better-auth/drizzle-adapter%60%29%20for%20better%20tree-shaking.)&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/8330)
Author
Owner

@leon commented on GitHub (Mar 3, 2026):

Thats Great!

<!-- gh-comment-id:3990084761 --> @leon commented on GitHub (Mar 3, 2026): Thats Great!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28380