[GH-ISSUE #8933] [Bug] auth generate error in sveltekit app #28565

Closed
opened 2026-04-17 20:00:45 -05:00 by GiteaMirror · 12 comments
Owner

Originally created by @bennajah on GitHub (Apr 3, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8933

Is this suited for github?

  • Yes, this is suited for github

Reproduction

  1. clone this repo https://github.com/bennajah/svelte-better-auth
  2. run auth generate
  3. see the error

Current vs. Expected behavior

getting this error

bennajah@MacBook-Pro my-app % bun auth:schema     
$ auth generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes
Couldn't read your auth config. Error: Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db'
Require stack:
- /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts
    at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
    at require.resolve (node:internal/modules/helpers:163:19)
    at jitiResolve (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:148703)
    at jitiRequire (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:150290)
    at import (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:158307)
    at /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts:6:17
    at async Function.import (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:158301)
    at async resolveConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/c12/dist/index.mjs:318:20)
    at async loadConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/c12/dist/index.mjs:147:22)
    at async getConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/auth/dist/index.mjs:1591:23) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts'
  ]
}
error: script "auth:schema" exited with code 1

What version of Better Auth are you using?

1.5.6

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:43 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T8142",
    "release": "25.4.0",
    "cpuCount": 10,
    "cpuModel": "Apple M5",
    "totalMemory": "16.00 GB",
    "freeMemory": "0.27 GB"
  },
  "node": {
    "version": "v24.14.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.12.1"
  },
  "frameworks": [
    {
      "name": "svelte",
      "version": "^5.55.1"
    },
    {
      "name": "@sveltejs/kit",
      "version": "^2.55.0"
    }
  ],
  "databases": [
    {
      "name": "@libsql/client",
      "version": "^0.17.2"
    },
    {
      "name": "drizzle",
      "version": "^0.45.2"
    }
  ],
  "betterAuth": {
    "version": "Unknown",
    "config": null,
    "error": "Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db'\nRequire stack:\n- /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts"
  }
}

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

Package

Auth config (if applicable)

import { betterAuth } from "better-auth/minimal";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { sveltekitCookies } from "better-auth/svelte-kit";
import { env } from "$env/dynamic/private";
import { getRequestEvent } from "$app/server";
import { db } from "$lib/server/db";
import * as schema from "$lib/server/db/schema";

export const auth = betterAuth({
  baseURL: env.ORIGIN,
  secret: env.BETTER_AUTH_SECRET,
  database: drizzleAdapter(db, { provider: "sqlite", schema }),
  emailAndPassword: { enabled: true },
  plugins: [sveltekitCookies(getRequestEvent)],
});

Additional context

No response

Originally created by @bennajah on GitHub (Apr 3, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8933 ### Is this suited for github? - [x] Yes, this is suited for github ### Reproduction 1. clone this repo https://github.com/bennajah/svelte-better-auth 2. run auth generate 3. see the error ### Current vs. Expected behavior getting this error ```zsh bennajah@MacBook-Pro my-app % bun auth:schema $ auth generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes Couldn't read your auth config. Error: Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db' Require stack: - /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15) at require.resolve (node:internal/modules/helpers:163:19) at jitiResolve (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:148703) at jitiRequire (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:150290) at import (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:158307) at /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts:6:17 at async Function.import (/Users/bennajah/Development/projects/my-app/node_modules/jiti/dist/jiti.cjs:1:158301) at async resolveConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/c12/dist/index.mjs:318:20) at async loadConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/c12/dist/index.mjs:147:22) at async getConfig (file:///Users/bennajah/Development/projects/my-app/node_modules/auth/dist/index.mjs:1591:23) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts' ] } error: script "auth:schema" exited with code 1 ``` ### What version of Better Auth are you using? 1.5.6 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:43 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T8142", "release": "25.4.0", "cpuCount": 10, "cpuModel": "Apple M5", "totalMemory": "16.00 GB", "freeMemory": "0.27 GB" }, "node": { "version": "v24.14.1", "env": "development" }, "packageManager": { "name": "npm", "version": "11.12.1" }, "frameworks": [ { "name": "svelte", "version": "^5.55.1" }, { "name": "@sveltejs/kit", "version": "^2.55.0" } ], "databases": [ { "name": "@libsql/client", "version": "^0.17.2" }, { "name": "drizzle", "version": "^0.45.2" } ], "betterAuth": { "version": "Unknown", "config": null, "error": "Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db'\nRequire stack:\n- /Users/bennajah/Development/projects/my-app/src/lib/server/auth.ts" } } ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth/minimal"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { sveltekitCookies } from "better-auth/svelte-kit"; import { env } from "$env/dynamic/private"; import { getRequestEvent } from "$app/server"; import { db } from "$lib/server/db"; import * as schema from "$lib/server/db/schema"; export const auth = betterAuth({ baseURL: env.ORIGIN, secret: env.BETTER_AUTH_SECRET, database: drizzleAdapter(db, { provider: "sqlite", schema }), emailAndPassword: { enabled: true }, plugins: [sveltekitCookies(getRequestEvent)], }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-04-17 20:00:45 -05:00
Author
Owner

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

The CLI's auth generate command uses jiti to load your auth config, and it has built-in support for resolving SvelteKit aliases like $lib, $env, and $app [1]. However, based on your error, it appears the alias resolution isn't kicking in for your setup.

Looking at the error path — Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db' — notice it's resolving to /Users/bennajah/Development/projects/src/lib/server/db instead of /Users/bennajah/Development/projects/my-app/src/lib/server/db. The my-app segment is missing, which suggests the $lib alias is being resolved relative to the wrong root directory.

Several fixes have been merged in this area recently:

  • PR #8520 (March 2026) fixed extended tsconfig resolution [2]
  • PR #7650 (January 2026) added jsconfig.json fallback support [3]
  • PR #4042 added SvelteKit-specific alias support for $lib, $app/server, and $env modules [4]

Make sure you're on the latest version of better-auth (your system info shows "version": "Unknown" which is suspicious). If you're already on the latest and still hitting this, the immediate workaround is to use relative import paths in your auth config instead of SvelteKit aliases [5]:

// Instead of:
import { db } from "$lib/server/db";
import * as schema from "$lib/server/db/schema";

// Use:
import { db } from "./db";
import * as schema from "./db/schema";

The $env and $app imports should be handled by the CLI's virtual module stubs [6], but $lib resolution depends on correctly identifying your project root directory — the mismatched path in your error suggests that may be failing.

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:4183864878 --> @dosubot[bot] commented on GitHub (Apr 3, 2026): <!-- Answer --> The CLI's `auth generate` command uses **jiti** to load your auth config, and it has built-in support for resolving SvelteKit aliases like `$lib`, `$env`, and `$app` [[1]](https://github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/add-svelte-kit-env-modules.ts). However, based on your error, it appears the alias resolution isn't kicking in for your setup. Looking at the error path — `Cannot find module '/Users/bennajah/Development/projects/src/lib/server/db'` — notice it's resolving to `/Users/bennajah/Development/projects/src/lib/server/db` instead of `/Users/bennajah/Development/projects/my-app/src/lib/server/db`. The `my-app` segment is missing, which suggests the `$lib` alias is being resolved relative to the wrong root directory. Several fixes have been merged in this area recently: - [PR #8520](https://github.com/better-auth/better-auth/pull/8520) (March 2026) fixed extended tsconfig resolution [[2]](https://github.com/better-auth/better-auth/pull/8520) - [PR #7650](https://github.com/better-auth/better-auth/pull/7650) (January 2026) added jsconfig.json fallback support [[3]](https://github.com/better-auth/better-auth/pull/7650) - [PR #4042](https://github.com/better-auth/better-auth/pull/4042) added SvelteKit-specific alias support for `$lib`, `$app/server`, and `$env` modules [[4]](https://github.com/better-auth/better-auth/pull/4042) Make sure you're on the latest version of `better-auth` (your system info shows `"version": "Unknown"` which is suspicious). If you're already on the latest and still hitting this, the **immediate workaround** is to use relative import paths in your auth config instead of SvelteKit aliases [[5]](https://github.com/better-auth/better-auth/issues/7033): ```typescript // Instead of: import { db } from "$lib/server/db"; import * as schema from "$lib/server/db/schema"; // Use: import { db } from "./db"; import * as schema from "./db/schema"; ``` The `$env` and `$app` imports should be handled by the CLI's virtual module stubs [[6]](https://github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/add-svelte-kit-env-modules.ts#L15-L81), but `$lib` resolution depends on correctly identifying your project root directory — the mismatched path in your error suggests that may be failing. <!-- 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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=2cfda659-8ada-4efa-993f-36d3376fa931&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=The%20CLI%27s%20%60auth%20generate%60%20command%20uses%20%2A%2Ajiti%2A%2A%20to%20load%20your%20auth%20config%2C%20and%20it%20has%20built-in%20support%20for%20resolving%20SvelteKit%20aliases%20like%20%60%24lib%60%2C%20%60%24env%60%2C%20and%20%60%24app%60%20%5B%5B1%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/add-svelte-kit-env-modules.ts%29.%20However%2C%20based%20on%20your%20error%2C%20it%20appears%20the%20alias%20resolution%20isn%27t%20kicking%20in%20for%20your%20setup.%0A%0ALooking%20at%20the%20error%20path%20%E2%80%94%20%60Cannot%20find%20module%20%27/Users/bennajah/Development/projects/src/lib/server/db%27%60%20%E2%80%94%20notice%20it%27s%20resolving%20to%20%60/Users/bennajah/Development/projects/src/lib/server/db%60%20instead%20of%20%60/Users/bennajah/Development/projects/my-app/src/lib/server/db%60.%20The%20%60my-app%60%20segment%20is%20missing%2C%20which%20suggests%20the%20%60%24lib%60%20alias%20is%20being%20resolved%20relative%20to%20the%20wrong%20root%20directory.%0A%0ASeveral%20fixes%20have%20been%20merged%20in%20this%20area%20recently%3A%0A%0A-%20%5BPR%20%238520%5D%28https%3A//github.com/better-auth/better-auth/pull/8520%29%20%28March%202026%29%20fixed%20extended%20tsconfig%20resolution%20%5B%5B2%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/8520%29%0A-%20%5BPR%20%237650%5D%28https%3A//github.com/better-auth/better-auth/pull/7650%29%20%28January%202026%29%20added%20jsconfig.json%20fallback%20support%20%5B%5B3%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/7650%29%0A-%20%5BPR%20%234042%5D%28https%3A//github.com/better-auth/better-auth/pull/4042%29%20added%20SvelteKit-specific%20alias%20support%20for%20%60%24lib%60%2C%20%60%24app/server%60%2C%20and%20%60%24env%60%20modules%20%5B%5B4%5D%5D%28https%3A//github.com/better-auth/better-auth/pull/4042%29%0A%0AMake%20sure%20you%27re%20on%20the%20latest%20version%20of%20%60better-auth%60%20%28your%20system%20info%20shows%20%60%22version%22%3A%20%22Unknown%22%60%20which%20is%20suspicious%29.%20If%20you%27re%20already%20on%20the%20latest%20and%20still%20hitting%20this%2C%20the%20%2A%2Aimmediate%20workaround%2A%2A%20is%20to%20use%20relative%20import%20paths%20in%20your%20auth%20config%20instead%20of%20SvelteKit%20aliases%20%5B%5B5%5D%5D%28https%3A//github.com/better-auth/better-auth/issues/7033%29%3A%0A%0A%60%60%60typescript%0A//%20Instead%20of%3A%0Aimport%20%7B%20db%20%7D%20from%20%22%24lib/server/db%22%3B%0Aimport%20%2A%20as%20schema%20from%20%22%24lib/server/db/schema%22%3B%0A%0A//%20Use%3A%0Aimport%20%7B%20db%20%7D%20from%20%22./db%22%3B%0Aimport%20%2A%20as%20schema%20from%20%22./db/schema%22%3B%0A%60%60%60%0A%0AThe%20%60%24env%60%20and%20%60%24app%60%20imports%20should%20be%20handled%20by%20the%20CLI%27s%20virtual%20module%20stubs%20%5B%5B6%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/add-svelte-kit-env-modules.ts%23L15-L81%29%2C%20but%20%60%24lib%60%20resolution%20depends%20on%20correctly%20identifying%20your%20project%20root%20directory%20%E2%80%94%20the%20mismatched%20path%20in%20your%20error%20suggests%20that%20may%20be%20failing.)&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/8933)
Author
Owner

@bennajah commented on GitHub (Apr 3, 2026):

is working when using

import { db } from "./db";
import * as schema from "./db/schema";

but this not working

import { db } from "$lib/server/db";
import * as schema from "$lib/server/db/schema";
<!-- gh-comment-id:4183949759 --> @bennajah commented on GitHub (Apr 3, 2026): is working when using ```ts import { db } from "./db"; import * as schema from "./db/schema"; ``` but this not working ```ts import { db } from "$lib/server/db"; import * as schema from "$lib/server/db/schema"; ```
Author
Owner

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

This is a confirmed limitation in the CLI's path alias resolution. The $lib alias handling in addSvelteKitEnvModules is called without the cwd parameter, so it falls back to process.cwd() instead of your actual project root — which is likely why your error showed the path resolving to /Users/bennajah/Development/projects/src/lib/server/db (missing the my-app segment).

There are several related open issues tracking this: #2252, #3211, and #6373. Using relative paths in your auth config is the recommended workaround for now.

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:4183960858 --> @dosubot[bot] commented on GitHub (Apr 3, 2026): <!-- Answer --> This is a confirmed limitation in the CLI's path alias resolution. The `$lib` alias handling in `addSvelteKitEnvModules` is called [without the `cwd` parameter](https://github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/get-config.ts#L144), so it falls back to `process.cwd()` instead of your actual project root — which is likely why your error showed the path resolving to `/Users/bennajah/Development/projects/src/lib/server/db` (missing the `my-app` segment). There are several related open issues tracking this: #2252, #3211, and #6373. Using relative paths in your auth config is the recommended workaround for now. <!-- 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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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=116f9a03-da15-4947-a376-af2376cb2abd&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%20confirmed%20limitation%20in%20the%20CLI%27s%20path%20alias%20resolution.%20The%20%60%24lib%60%20alias%20handling%20in%20%60addSvelteKitEnvModules%60%20is%20called%20%5Bwithout%20the%20%60cwd%60%20parameter%5D%28https%3A//github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/get-config.ts%23L144%29%2C%20so%20it%20falls%20back%20to%20%60process.cwd%28%29%60%20instead%20of%20your%20actual%20project%20root%20%E2%80%94%20which%20is%20likely%20why%20your%20error%20showed%20the%20path%20resolving%20to%20%60/Users/bennajah/Development/projects/src/lib/server/db%60%20%28missing%20the%20%60my-app%60%20segment%29.%0A%0AThere%20are%20several%20related%20open%20issues%20tracking%20this%3A%20%232252%2C%20%233211%2C%20and%20%236373.%20Using%20relative%20paths%20in%20your%20auth%20config%20is%20the%20recommended%20workaround%20for%20now.)&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/8933)
Author
Owner

@bennajah commented on GitHub (Apr 3, 2026):

It works with auth@1.5.4 when running:

npx auth@1.5.4 generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes

and using:

import { db } from "$lib/server/db";
import * as schema from "$lib/server/db/schema";

However, it throws an error when using the latest version:

npx auth@latest generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes
<!-- gh-comment-id:4183977270 --> @bennajah commented on GitHub (Apr 3, 2026): It works with `auth@1.5.4` when running: ```zsh npx auth@1.5.4 generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes ``` and using: ```ts import { db } from "$lib/server/db"; import * as schema from "$lib/server/db/schema"; ``` However, it throws an error when using the latest version: ```zsh npx auth@latest generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes ```
Author
Owner

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

This looks like a regression introduced in PR #8520, which was merged on March 9, 2026 and released in v1.5.5. That PR refactored how the CLI resolves tsconfig path aliases — it replaced the old custom parsing (which used path.join(cwd, "tsconfig.json") to load the config from the exact project directory) with the get-tsconfig library, which traverses upward through parent directories to find a tsconfig [1].

In your case, the error path /Users/bennajah/Development/projects/src/lib/server/db is missing the my-app segment, which is consistent with getTsconfig() finding a parent directory's tsconfig and then resolving $lib relative to that parent instead of your actual project root [2].

This same regression was reported by another user on March 31 in a monorepo setup with the exact same symptom — paths resolving relative to the wrong base directory.

Pinning to auth@1.5.4 is a valid workaround for now, as that version used the old tsconfig parsing logic that didn't traverse upward.

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:4184009232 --> @dosubot[bot] commented on GitHub (Apr 3, 2026): <!-- Answer --> This looks like a regression introduced in [PR #8520](https://github.com/better-auth/better-auth/pull/8520), which was merged on March 9, 2026 and released in **v1.5.5**. That PR refactored how the CLI resolves tsconfig path aliases — it replaced the old custom parsing (which used `path.join(cwd, "tsconfig.json")` to load the config from the exact project directory) with the `get-tsconfig` library, which traverses **upward** through parent directories to find a tsconfig [[1]](https://github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/get-config.ts#L137). In your case, the error path `/Users/bennajah/Development/projects/src/lib/server/db` is missing the `my-app` segment, which is consistent with `getTsconfig()` finding a parent directory's tsconfig and then resolving `$lib` relative to that parent instead of your actual project root [[2]](https://github.com/better-auth/better-auth/issues/6373#issuecomment-4056158210). This same regression was [reported by another user on March 31](https://github.com/better-auth/better-auth/issues/6373#issuecomment-4056158210) in a monorepo setup with the exact same symptom — paths resolving relative to the wrong base directory. Pinning to `auth@1.5.4` is a valid workaround for now, as that version used the old tsconfig parsing logic that didn't traverse upward. <!-- 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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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=25f321c8-1e0c-4fc0-8c99-0b5eb78146f9&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%20looks%20like%20a%20regression%20introduced%20in%20%5BPR%20%238520%5D%28https%3A//github.com/better-auth/better-auth/pull/8520%29%2C%20which%20was%20merged%20on%20March%209%2C%202026%20and%20released%20in%20%2A%2Av1.5.5%2A%2A.%20That%20PR%20refactored%20how%20the%20CLI%20resolves%20tsconfig%20path%20aliases%20%E2%80%94%20it%20replaced%20the%20old%20custom%20parsing%20%28which%20used%20%60path.join%28cwd%2C%20%22tsconfig.json%22%29%60%20to%20load%20the%20config%20from%20the%20exact%20project%20directory%29%20with%20the%20%60get-tsconfig%60%20library%2C%20which%20traverses%20%2A%2Aupward%2A%2A%20through%20parent%20directories%20to%20find%20a%20tsconfig%20%5B%5B1%5D%5D%28https%3A//github.com/better-auth/better-auth/blob/77ead28455cb41f403adcb7b67d0d9fc4fa78286/packages/cli/src/utils/get-config.ts%23L137%29.%0A%0AIn%20your%20case%2C%20the%20error%20path%20%60/Users/bennajah/Development/projects/src/lib/server/db%60%20is%20missing%20the%20%60my-app%60%20segment%2C%20which%20is%20consistent%20with%20%60getTsconfig%28%29%60%20finding%20a%20parent%20directory%27s%20tsconfig%20and%20then%20resolving%20%60%24lib%60%20relative%20to%20that%20parent%20instead%20of%20your%20actual%20project%20root%20%5B%5B2%5D%5D%28https%3A//github.com/better-auth/better-auth/issues/6373%23issuecomment-4056158210%29.%0A%0AThis%20same%20regression%20was%20%5Breported%20by%20another%20user%20on%20March%2031%5D%28https%3A//github.com/better-auth/better-auth/issues/6373%23issuecomment-4056158210%29%20in%20a%20monorepo%20setup%20with%20the%20exact%20same%20symptom%20%E2%80%94%20paths%20resolving%20relative%20to%20the%20wrong%20base%20directory.%0A%0APinning%20to%20%60auth%401.5.4%60%20is%20a%20valid%20workaround%20for%20now%2C%20as%20that%20version%20used%20the%20old%20tsconfig%20parsing%20logic%20that%20didn%27t%20traverse%20upward.)&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/8933)
Author
Owner

@DarthGigi commented on GitHub (Apr 5, 2026):

Having the same issue, I commented here: https://github.com/better-auth/better-auth/issues/6373#issuecomment-4056158210 but I haven't gotten any replies.

~/Projects/MC-ID/website
pnx auth@latest generate --adapter drizzle                                                                                                                                                                                                     
[#better-auth]: Couldn't read your auth config. Error: Cannot find module '/Users/gigi/Projects/MC-ID/src/lib/server/email-service'
Require stack:
- /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts
    at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
    at require.resolve (node:internal/modules/helpers:163:19)
    at jitiResolve (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:148703)
    at jitiRequire (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150290)
    at import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158307)
    at /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts:5:27
    at async Function.import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158301)
    at async resolveConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:318:20)
    at async loadConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:147:22)
    at async getConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/auth@1.5.6_@better-fetch+fetch@1.1.21_@opentelemetry+api@1.9.1_better-call@1.3.2_zod@4._51ff88b236c456853f5a87b683b46691/node_modules/auth/dist/index.mjs:1605:23) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts' ]
}

I don't get why it tries to look in /Users/gigi/Projects/MC-ID and not /Users/gigi/Projects/MC-ID/website as this is a monorepo.

<!-- gh-comment-id:4189080622 --> @DarthGigi commented on GitHub (Apr 5, 2026): Having the same issue, I commented here: https://github.com/better-auth/better-auth/issues/6373#issuecomment-4056158210 but I haven't gotten any replies. ``` ~/Projects/MC-ID/website pnx auth@latest generate --adapter drizzle [#better-auth]: Couldn't read your auth config. Error: Cannot find module '/Users/gigi/Projects/MC-ID/src/lib/server/email-service' Require stack: - /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15) at require.resolve (node:internal/modules/helpers:163:19) at jitiResolve (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:148703) at jitiRequire (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150290) at import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158307) at /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts:5:27 at async Function.import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158301) at async resolveConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:318:20) at async loadConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:147:22) at async getConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/auth@1.5.6_@better-fetch+fetch@1.1.21_@opentelemetry+api@1.9.1_better-call@1.3.2_zod@4._51ff88b236c456853f5a87b683b46691/node_modules/auth/dist/index.mjs:1605:23) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts' ] } ``` I don't get why it tries to look in `/Users/gigi/Projects/MC-ID` and not `/Users/gigi/Projects/MC-ID/website` as this is a monorepo.
Author
Owner

@bennajah commented on GitHub (Apr 5, 2026):

Having the same issue, I commented here: #6373 (comment) but I haven't gotten any replies.

~/Projects/MC-ID/website
pnx auth@latest generate --adapter drizzle                                                                                                                                                                                                     
[#better-auth]: Couldn't read your auth config. Error: Cannot find module '/Users/gigi/Projects/MC-ID/src/lib/server/email-service'
Require stack:
- /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts
    at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
    at require.resolve (node:internal/modules/helpers:163:19)
    at jitiResolve (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:148703)
    at jitiRequire (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150290)
    at import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158307)
    at /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts:5:27
    at async Function.import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158301)
    at async resolveConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:318:20)
    at async loadConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:147:22)
    at async getConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/auth@1.5.6_@better-fetch+fetch@1.1.21_@opentelemetry+api@1.9.1_better-call@1.3.2_zod@4._51ff88b236c456853f5a87b683b46691/node_modules/auth/dist/index.mjs:1605:23) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts' ]
}

I don't get why it tries to look in /Users/gigi/Projects/MC-ID and not /Users/gigi/Projects/MC-ID/website as this is a monorepo.

you can downgrade to this cli version
auth@1.5.4

<!-- gh-comment-id:4189274595 --> @bennajah commented on GitHub (Apr 5, 2026): > Having the same issue, I commented here: [#6373 (comment)](https://github.com/better-auth/better-auth/issues/6373#issuecomment-4056158210) but I haven't gotten any replies. > > ``` > ~/Projects/MC-ID/website > pnx auth@latest generate --adapter drizzle > [#better-auth]: Couldn't read your auth config. Error: Cannot find module '/Users/gigi/Projects/MC-ID/src/lib/server/email-service' > Require stack: > - /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts > at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15) > at require.resolve (node:internal/modules/helpers:163:19) > at jitiResolve (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:148703) > at jitiRequire (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150290) > at import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158307) > at /Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts:5:27 > at async Function.import (/Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:158301) > at async resolveConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:318:20) > at async loadConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/c12@3.3.4/node_modules/c12/dist/index.mjs:147:22) > at async getConfig (file:///Users/gigi/Library/Caches/pnpm/dlx/c4ca24f8ecaec5e725d44d89afcc74114905512d4d6ead6a3d17adc8e510c4ea/19d5e488108-e9fc/node_modules/.pnpm/auth@1.5.6_@better-fetch+fetch@1.1.21_@opentelemetry+api@1.9.1_better-call@1.3.2_zod@4._51ff88b236c456853f5a87b683b46691/node_modules/auth/dist/index.mjs:1605:23) { > code: 'MODULE_NOT_FOUND', > requireStack: [ '/Users/gigi/Projects/MC-ID/website/src/lib/server/auth.ts' ] > } > ``` > > I don't get why it tries to look in `/Users/gigi/Projects/MC-ID` and not `/Users/gigi/Projects/MC-ID/website` as this is a monorepo. you can downgrade to this cli version auth@1.5.4
Author
Owner

@DarthGigi commented on GitHub (Apr 5, 2026):

I tried downgrading but that didn't work for me, unfortunately

<!-- gh-comment-id:4189390334 --> @DarthGigi commented on GitHub (Apr 5, 2026): I tried downgrading but that didn't work for me, unfortunately
Author
Owner

@bennajah commented on GitHub (Apr 5, 2026):

I tried downgrading but that didn't work for me, unfortunately

see this

https://github.com/better-auth/better-auth/issues/8933#issuecomment-4183949759

<!-- gh-comment-id:4189397189 --> @bennajah commented on GitHub (Apr 5, 2026): > I tried downgrading but that didn't work for me, unfortunately see this https://github.com/better-auth/better-auth/issues/8933#issuecomment-4183949759
Author
Owner

@bytaesu commented on GitHub (Apr 10, 2026):

Hi everyone 😁

npx https://pkg.pr.new/auth@895d48a

This CLI includes the fix from PR #9032, could you check if the issue is resolved with this version?

I'd like to check whether this fix resolves the issue in your setup 🙏

<!-- gh-comment-id:4219228447 --> @bytaesu commented on GitHub (Apr 10, 2026): Hi everyone 😁 ``` npx https://pkg.pr.new/auth@895d48a ``` This CLI includes the fix from PR #9032, could you check if the issue is resolved with this version? I'd like to check whether this fix resolves the issue in your setup 🙏
Author
Owner

@DarthGigi commented on GitHub (Apr 10, 2026):

@bytaesu I'm still getting the following errors:

[#better-auth]: Couldn't read your auth config. Error: Cannot find module '$app/environment'
[#better-auth]: Couldn't read your auth config. Error: Cannot find module '$src/app.css?inline'
<!-- gh-comment-id:4225087144 --> @DarthGigi commented on GitHub (Apr 10, 2026): @bytaesu I'm still getting the following errors: ``` [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$app/environment' [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$src/app.css?inline' ```
Author
Owner

@bytaesu commented on GitHub (Apr 10, 2026):

@bytaesu I'm still getting the following errors:

[#better-auth]: Couldn't read your auth config. Error: Cannot find module '$app/environment'
[#better-auth]: Couldn't read your auth config. Error: Cannot find module '$src/app.css?inline'

I'll try to address this in a separate PR. I'll mention you once I've opened it 🫡

<!-- gh-comment-id:4225140601 --> @bytaesu commented on GitHub (Apr 10, 2026): > [@bytaesu](https://github.com/bytaesu) I'm still getting the following errors: > > ``` > [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$app/environment' > [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$src/app.css?inline' > ``` I'll try to address this in a separate PR. I'll mention you once I've opened it 🫡
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28565