Nextjs demo README is out of date (was: does not work) #2031

Closed
opened 2026-03-13 09:22:01 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @dickhardt on GitHub (Sep 27, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

clone repo
pnpm i
cd demo/nextjs
pnpm i
mv .env.example .env
pnpm run dev

Current vs. Expected behavior

nextjs % pnpm dev                                                                                                        (canary)better-auth

> @better-auth/demo@0.1.0 dev /Users/dick/github/DickHardt/better-auth/demo/nextjs
> next dev

   ▲ Next.js 15.5.2
   - Local:        http://localhost:3000
   - Network:      http://192.168.1.73:3000
   - Environments: .env

 ✓ Starting...
 ✓ Ready in 1206ms
 ○ Compiling / ...
 ⨯ ./lib/auth.ts:1:1
Module not found: Can't resolve 'better-auth'
> 1 | import { betterAuth } from "better-auth";
    | ^
  2 | import {
  3 | 	bearer,
  4 | 	admin,

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ ./lib/auth.ts:1:1
Module not found: Can't resolve 'better-auth'
> 1 | import { betterAuth } from "better-auth";
    | ^
  2 | import {
  3 | 	bearer,
  4 | 	admin,

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ ./lib/auth.ts:1:1
Module not found: Can't resolve 'better-auth'
> 1 | import { betterAuth } from "better-auth";
    | ^
  2 | import {
  3 | 	bearer,
  4 | 	admin,

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/sign-in-btn.tsx
./app/page.tsx
 GET / 500 in 2412ms
 ⚠ Cross origin request detected from 192.168.1.73 to /_next/* resource. In a future major version of Next.js, you will need to explicitly configure "allowedDevOrigins" in next.config to allow this.
Read more: https://nextjs.org/docs/app/api-reference/config/next-config-js/allowedDevOrigins
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
 ⨯ ./lib/auth.ts:1:1
Module not found: Can't resolve 'better-auth'
> 1 | import { betterAuth } from "better-auth";
    | ^
  2 | import {
  3 | 	bearer,
  4 | 	admin,

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ ./lib/auth.ts:1:1
Module not found: Can't resolve 'better-auth'
> 1 | import { betterAuth } from "better-auth";
    | ^
  2 | import {
  3 | 	bearer,
  4 | 	admin,

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./components/sign-in-btn.tsx
./app/page.tsx
 GET / 500 in 290ms

What version of Better Auth are you using?

0.0.2-beta.8

System info

NA

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 @dickhardt on GitHub (Sep 27, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce clone repo pnpm i cd demo/nextjs pnpm i mv .env.example .env pnpm run dev ### Current vs. Expected behavior ```bash nextjs % pnpm dev (canary)better-auth > @better-auth/demo@0.1.0 dev /Users/dick/github/DickHardt/better-auth/demo/nextjs > next dev ▲ Next.js 15.5.2 - Local: http://localhost:3000 - Network: http://192.168.1.73:3000 - Environments: .env ✓ Starting... ✓ Ready in 1206ms ○ Compiling / ... ⨯ ./lib/auth.ts:1:1 Module not found: Can't resolve 'better-auth' > 1 | import { betterAuth } from "better-auth"; | ^ 2 | import { 3 | bearer, 4 | admin, https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./components/sign-in-btn.tsx ./app/page.tsx ⨯ ./lib/auth.ts:1:1 Module not found: Can't resolve 'better-auth' > 1 | import { betterAuth } from "better-auth"; | ^ 2 | import { 3 | bearer, 4 | admin, https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./components/sign-in-btn.tsx ./app/page.tsx ⨯ ./lib/auth.ts:1:1 Module not found: Can't resolve 'better-auth' > 1 | import { betterAuth } from "better-auth"; | ^ 2 | import { 3 | bearer, 4 | admin, https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./components/sign-in-btn.tsx ./app/page.tsx GET / 500 in 2412ms ⚠ Cross origin request detected from 192.168.1.73 to /_next/* resource. In a future major version of Next.js, you will need to explicitly configure "allowedDevOrigins" in next.config to allow this. Read more: https://nextjs.org/docs/app/api-reference/config/next-config-js/allowedDevOrigins ⚠ Fast Refresh had to perform a full reload due to a runtime error. ⨯ ./lib/auth.ts:1:1 Module not found: Can't resolve 'better-auth' > 1 | import { betterAuth } from "better-auth"; | ^ 2 | import { 3 | bearer, 4 | admin, https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./components/sign-in-btn.tsx ./app/page.tsx ⨯ ./lib/auth.ts:1:1 Module not found: Can't resolve 'better-auth' > 1 | import { betterAuth } from "better-auth"; | ^ 2 | import { 3 | bearer, 4 | admin, https://nextjs.org/docs/messages/module-not-found Import trace for requested module: ./components/sign-in-btn.tsx ./app/page.tsx GET / 500 in 290ms ``` ### What version of Better Auth are you using? 0.0.2-beta.8 ### System info ```bash NA ``` ### 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 nextjs label 2026-03-13 09:22:01 -05:00
Author
Owner

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

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

The error happens because the Next.js demo depends on workspace packages like "better-auth" that aren't available if you only install dependencies inside demo/nextjs. To fix this, you need to:

  1. Clone the entire monorepo (not just the demo directory).
  2. From the repo root, run pnpm install.
  3. From the repo root, run pnpm build to build all packages.
  4. Then cd demo/nextjs, set up your .env, and run pnpm dev.

You can't run the demo in isolation because it relies on local workspace dependencies that must be built first. More details are in this related issue.

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 27, 2025): <!-- Greeting --> Hi @dickhardt! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The error happens because the Next.js demo depends on workspace packages like "better-auth" that aren't available if you only install dependencies inside demo/nextjs. To fix this, you need to: 1. Clone the entire monorepo (not just the demo directory). 2. From the repo root, run pnpm install. 3. From the repo root, run pnpm build to build all packages. 4. Then cd demo/nextjs, set up your .env, and run pnpm dev. You can't run the demo in isolation because it relies on local workspace dependencies that must be built first. More details are in this [related issue](https://github.com/better-auth/better-auth/issues/4820). <!-- 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/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/06ffa7aa-f6fc-478b-a672-1d0aad69ea69?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/4946)
Author
Owner

@dickhardt commented on GitHub (Sep 27, 2025):

That is not what the directions are at https://github.com/better-auth/better-auth/blob/canary/demo/nextjs/README.md

I ran pnpm build and now I get this error

√ nextjs % pnpm run dev                                                                                                    (canary)better-auth

> @better-auth/demo@0.1.0 dev /Users/dick/github/DickHardt/better-auth/demo/nextjs
> next dev

   ▲ Next.js 15.5.2
   - Local:        http://localhost:3000
   - Network:      http://192.168.1.73:3000
   - Environments: .env

 ✓ Starting...
 ✓ Ready in 1232ms
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
 ○ Compiling / ...
 ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
../../packages/better-auth/dist/integrations/next-js.mjs
./lib/auth.ts
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined =
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined = {
  page: '/'
}
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
 GET / 500 in 2283ms
 ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
../../packages/better-auth/dist/integrations/next-js.mjs
./lib/auth.ts
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined =
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined = {
  page: '/'
}
 GET / 500 in 756ms
 ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
../../packages/better-auth/dist/index.mjs
./lib/auth.ts
./components/sign-in-btn.tsx
./app/page.tsx
 ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
../../packages/better-auth/dist/index.mjs
./lib/auth.ts
./components/sign-in-btn.tsx
./app/page.tsx
 ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs
../../packages/better-auth/dist/index.mjs
./lib/auth.ts
./components/sign-in-btn.tsx
./app/page.tsx
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined =
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined =
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined = {
  page: '/'
}
 ⨯ Error: No dialect found
    at eval (lib/auth.ts:50:8)
    at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1)
    at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67)
    at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1)
    at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81)
    at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1)
  48 |
  49 | if (!dialect) {
> 50 | 	throw new Error("No dialect found");
     | 	      ^
  51 | }
  52 |
  53 | const baseURL: string | undefined = {
  page: '/'
}
 GET / 500 in 1724ms```
@dickhardt commented on GitHub (Sep 27, 2025): That is not what the directions are at https://github.com/better-auth/better-auth/blob/canary/demo/nextjs/README.md I ran pnpm build and now I get this error ```bash √ nextjs % pnpm run dev (canary)better-auth > @better-auth/demo@0.1.0 dev /Users/dick/github/DickHardt/better-auth/demo/nextjs > next dev ▲ Next.js 15.5.2 - Local: http://localhost:3000 - Network: http://192.168.1.73:3000 - Environments: .env ✓ Starting... ✓ Ready in 1232ms ⚠ Fast Refresh had to perform a full reload due to a runtime error. ○ Compiling / ... ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs Critical dependency: the request of a dependency is an expression Import trace for requested module: ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs ../../packages/better-auth/dist/integrations/next-js.mjs ./lib/auth.ts ./components/sign-in-btn.tsx ./app/page.tsx ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = { page: '/' } ⚠ Fast Refresh had to perform a full reload due to a runtime error. GET / 500 in 2283ms ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs Critical dependency: the request of a dependency is an expression Import trace for requested module: ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs ../../packages/better-auth/dist/integrations/next-js.mjs ./lib/auth.ts ./components/sign-in-btn.tsx ./app/page.tsx ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = { page: '/' } GET / 500 in 756ms ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs Critical dependency: the request of a dependency is an expression Import trace for requested module: ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs ../../packages/better-auth/dist/index.mjs ./lib/auth.ts ./components/sign-in-btn.tsx ./app/page.tsx ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs Critical dependency: the request of a dependency is an expression Import trace for requested module: ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs ../../packages/better-auth/dist/index.mjs ./lib/auth.ts ./components/sign-in-btn.tsx ./app/page.tsx ⚠ ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs Critical dependency: the request of a dependency is an expression Import trace for requested module: ../../packages/better-auth/dist/shared/better-auth.CJ2rnsDV.mjs ../../packages/better-auth/dist/index.mjs ./lib/auth.ts ./components/sign-in-btn.tsx ./app/page.tsx ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = { page: '/' } ⨯ Error: No dialect found at eval (lib/auth.ts:50:8) at <unknown> (rsc)/./lib/auth.ts (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:951:1) at eval (webpack-internal:///(rsc)/./components/sign-in-btn.tsx:11:67) at <unknown> (rsc)/./components/sign-in-btn.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:896:1) at eval (webpack-internal:///(rsc)/./app/page.tsx:7:81) at <unknown> (rsc)/./app/page.tsx (/Users/dick/github/DickHardt/better-auth/demo/nextjs/.next/server/app/page.js:885:1) 48 | 49 | if (!dialect) { > 50 | throw new Error("No dialect found"); | ^ 51 | } 52 | 53 | const baseURL: string | undefined = { page: '/' } GET / 500 in 1724ms```
Author
Owner

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

The "No dialect found" error happens because the demo expects certain environment variables to be set for database configuration, but the README doesn't make this clear. In demo/nextjs/lib/auth.ts, the dialect is determined like this: if USE_MYSQL is set, you must also set MYSQL_DATABASE_URL; otherwise, you need both TURSO_DATABASE_URL and TURSO_AUTH_TOKEN for Turso/Libsql. If none of these are set, you'll get the error you saw. See the code logic here.

To fix it, make sure your .env file includes either:

  • USE_MYSQL=true and MYSQL_DATABASE_URL=your_mysql_url
    or
  • TURSO_DATABASE_URL=your_turso_url and TURSO_AUTH_TOKEN=your_turso_token

The .env.example file lists the Turso variables but doesn't explain their role in dialect selection, and the README doesn't mention this requirement source.

The "Critical dependency: the request of a dependency is an expression" warning is related to dynamic imports in the build, but it doesn't directly break the demo—it's mostly a warning about how Webpack handles dynamic requires.

If you set the required environment variables, the demo should start without the dialect error. If you want to use MySQL, set both USE_MYSQL and MYSQL_DATABASE_URL; for Turso, set both TURSO_DATABASE_URL and TURSO_AUTH_TOKEN. If you need more details on the dialect logic, see the merged PR that improved error messaging and dialect selection here.

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 27, 2025): <!-- Answer --> The "No dialect found" error happens because the demo expects certain environment variables to be set for database configuration, but the README doesn't make this clear. In `demo/nextjs/lib/auth.ts`, the dialect is determined like this: if `USE_MYSQL` is set, you must also set `MYSQL_DATABASE_URL`; otherwise, you need both `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN` for Turso/Libsql. If none of these are set, you'll get the error you saw. See the code logic [here](https://github.com/better-auth/better-auth/blob/f6cbdcc84ee5d2971fdcc8b23ff7c174f88cf45b/demo/nextjs/lib/auth.ts). To fix it, make sure your `.env` file includes either: - `USE_MYSQL=true` and `MYSQL_DATABASE_URL=your_mysql_url` or - `TURSO_DATABASE_URL=your_turso_url` and `TURSO_AUTH_TOKEN=your_turso_token` The `.env.example` file lists the Turso variables but doesn't explain their role in dialect selection, and the README doesn't mention this requirement [source](https://github.com/better-auth/better-auth/blob/f6cbdcc84ee5d2971fdcc8b23ff7c174f88cf45b/demo/nextjs/README.md). The "Critical dependency: the request of a dependency is an expression" warning is related to dynamic imports in the build, but it doesn't directly break the demo—it's mostly a warning about how Webpack handles dynamic requires. If you set the required environment variables, the demo should start without the dialect error. If you want to use MySQL, set both `USE_MYSQL` and `MYSQL_DATABASE_URL`; for Turso, set both `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN`. If you need more details on the dialect logic, see the merged PR that improved error messaging and dialect selection [here](https://github.com/better-auth/better-auth/pull/3789). <!-- 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/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6acf2671-77ee-4513-8ac6-8cd9b8a3184a?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/4946)
Author
Owner

@dickhardt commented on GitHub (Sep 27, 2025):

I'm up and running now -- but the README should get updated per above

@dickhardt commented on GitHub (Sep 27, 2025): I'm up and running now -- but the README should get updated per above
Author
Owner

@Bekacru commented on GitHub (Sep 28, 2025):

Updated!

@Bekacru commented on GitHub (Sep 28, 2025): Updated!
Author
Owner

@corentinmusard commented on GitHub (Oct 22, 2025):

  • Clone the entire monorepo (not just the demo directory).

  • From the repo root, run pnpm install.

  • From the repo root, run pnpm build to build all packages.

That's still missing in the README.

Btw npm install doesn't work.

@corentinmusard commented on GitHub (Oct 22, 2025): > * Clone the entire monorepo (not just the demo directory). > > * From the repo root, run pnpm install. > > * From the repo root, run pnpm build to build all packages. That's still missing in the README. Btw `npm install` doesn't work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2031