Session object always exists (but session.user and session.session are null) when user is not logged in #2739

Closed
opened 2026-03-13 10:16:39 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @vannamphuc on GitHub (Jan 20, 2026).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Clear all cookies or use incognito mode / log out completely
  2. Visit any page (e.g. /login, /signup, or even a protected route)
  3. On server-side:
import { redirect } from '@tanstack/react-router'
import { getRequestHeaders } from '@tanstack/react-start/server'
import { createServerFn } from '@tanstack/react-start'
import { auth } from '@/lib/auth'

export const getSessionFn = createServerFn({
  method: 'GET',
}).handler(async () => {
  const headers = getRequestHeaders()
  const session = await auth.api.getSession({ headers })

  if (!session) {
    throw redirect({ to: '/login' })
  }

  return session
})

On client-side:

 const { data: session, isPending } = authClient.useSession()
  console.log("🚀 ~ Navbar ~ session:", session)

Current vs. Expected behavior

Even when the user is not logged in useSession() returns an object with session: undefined and user: undefined but data. And no matter whether I call the signUp, signIn, or signOut function, it returns this to me. And this code log a session like function above.

const { data: session, isPending } = authClient.useSession()
  console.log('🚀 ~ Navbar ~ session:', session)
Image

I have completed the entire documentation.

path: src/lib/auth.ts
import { betterAuth } from 'better-auth'
import { prismaAdapter } from 'better-auth/adapters/prisma'
import { tanstackStartCookies } from "better-auth/tanstack-start";
import { prisma } from '@/db'

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: 'postgresql',
  }),
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
  },
  plugins: [tanstackStartCookies()],
})

Path: src/routes/api/auth/$.ts

import { createFileRoute } from '@tanstack/react-router'
import { auth } from '@/lib/auth'

export const Route = createFileRoute('/api/auth/$')({
  server: {
    handlers: {
      GET: async ({ request }: { request: Request }) => {
        return await auth.handler(request)
      },
      POST: async ({ request }: { request: Request }) => {
        return await auth.handler(request)
      },
    },
  },
})

What version of Better Auth are you using?

1.4.15

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Home Single Language",
    "release": "10.0.26200",
    "cpuCount": 16,
    "cpuModel": "11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz",
    "totalMemory": "15.71 GB",
    "freeMemory": "4.82 GB"
  },
  "node": {
    "version": "v22.12.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "10.9.0"
  },
  "frameworks": [
    {
      "name": "react",
      "version": "^19.2.0"
    }
  ],
  "databases": [
    {
      "name": "@prisma/client",
      "version": "^7.2.0"
    }
  ],
  "betterAuth": {
    "version": "^1.4.15",
    "config": {
      "emailAndPassword": {
        "enabled": true,
        "requireEmailVerification": false
      },
      "plugins": [
        {
          "name": "tanstack-start-cookies",
          "config": {
            "id": "tanstack-start-cookies",
            "hooks": {
              "after": [
                {}
              ]
            }
          }
        }
      ]
    }
  }
}

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

Client

Auth config (if applicable)

import { betterAuth } from 'better-auth'
import { prismaAdapter } from 'better-auth/adapters/prisma'
import { tanstackStartCookies } from "better-auth/tanstack-start";
import { prisma } from '@/db'

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: 'postgresql',
  }),
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
  },
  plugins: [tanstackStartCookies()],
})

Additional context

Framework: TanStack Start (React Server Components)
Related files:

  • @src/lib/auth.ts
  • @src/lib/auth-client.ts
  • @src/components/web/navbar.tsx
  • @src/components/web/login-form.tsx
  • @src/components/web/signup-form.tsx

At approximately 9 PM on January 20, 2026, UTC+7 (~14:00 UTC), the system was functioning normally (successful login/logout, sessions created/deleted correctly).

Originally created by @vannamphuc on GitHub (Jan 20, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Clear all cookies or use incognito mode / log out completely 2. Visit any page (e.g. `/login`, `/signup`, or even a protected route) 3. On server-side: ```jsx import { redirect } from '@tanstack/react-router' import { getRequestHeaders } from '@tanstack/react-start/server' import { createServerFn } from '@tanstack/react-start' import { auth } from '@/lib/auth' export const getSessionFn = createServerFn({ method: 'GET', }).handler(async () => { const headers = getRequestHeaders() const session = await auth.api.getSession({ headers }) if (!session) { throw redirect({ to: '/login' }) } return session }) ``` On client-side: ```jsx const { data: session, isPending } = authClient.useSession() console.log("🚀 ~ Navbar ~ session:", session) ``` ### Current vs. Expected behavior Even when the user is not logged in useSession() returns an object with session: undefined and user: undefined but data. And no matter whether I call the signUp, signIn, or signOut function, it returns this to me. And this code log a session like function above. ```jsx const { data: session, isPending } = authClient.useSession() console.log('🚀 ~ Navbar ~ session:', session) ``` <img width="788" height="573" alt="Image" src="https://github.com/user-attachments/assets/70fec5fb-a4dd-4a28-8844-90d011fe73cc" /> I have completed the entire documentation. ```jsx path: src/lib/auth.ts import { betterAuth } from 'better-auth' import { prismaAdapter } from 'better-auth/adapters/prisma' import { tanstackStartCookies } from "better-auth/tanstack-start"; import { prisma } from '@/db' export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: 'postgresql', }), emailAndPassword: { enabled: true, requireEmailVerification: false, }, plugins: [tanstackStartCookies()], }) ``` ```jsx Path: src/routes/api/auth/$.ts import { createFileRoute } from '@tanstack/react-router' import { auth } from '@/lib/auth' export const Route = createFileRoute('/api/auth/$')({ server: { handlers: { GET: async ({ request }: { request: Request }) => { return await auth.handler(request) }, POST: async ({ request }: { request: Request }) => { return await auth.handler(request) }, }, }, }) ``` ### What version of Better Auth are you using? 1.4.15 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Home Single Language", "release": "10.0.26200", "cpuCount": 16, "cpuModel": "11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz", "totalMemory": "15.71 GB", "freeMemory": "4.82 GB" }, "node": { "version": "v22.12.0", "env": "development" }, "packageManager": { "name": "npm", "version": "10.9.0" }, "frameworks": [ { "name": "react", "version": "^19.2.0" } ], "databases": [ { "name": "@prisma/client", "version": "^7.2.0" } ], "betterAuth": { "version": "^1.4.15", "config": { "emailAndPassword": { "enabled": true, "requireEmailVerification": false }, "plugins": [ { "name": "tanstack-start-cookies", "config": { "id": "tanstack-start-cookies", "hooks": { "after": [ {} ] } } } ] } } } ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from 'better-auth' import { prismaAdapter } from 'better-auth/adapters/prisma' import { tanstackStartCookies } from "better-auth/tanstack-start"; import { prisma } from '@/db' export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: 'postgresql', }), emailAndPassword: { enabled: true, requireEmailVerification: false, }, plugins: [tanstackStartCookies()], }) ``` ### Additional context Framework: TanStack Start (React Server Components) Related files: - @src/lib/auth.ts - @src/lib/auth-client.ts - @src/components/web/navbar.tsx - @src/components/web/login-form.tsx - @src/components/web/signup-form.tsx At approximately 9 PM on January 20, 2026, UTC+7 (~14:00 UTC), the system was functioning normally (successful login/logout, sessions created/deleted correctly).
GiteaMirror added the tanstack-start label 2026-03-13 10:16:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2026):

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

This is expected behavior in Better Auth. The useSession hook always returns an object for state management, but its data property is set to null when the user is not authenticated. There is no configuration to make useSession itself return null or undefined; instead, you should check if data is null to determine if the user is logged out. This pattern is intentional and matches how the session endpoint works on the server—if there’s no session, it returns null, and the client store’s data becomes null as well (source).

Best practice is to check both isPending and data before rendering authenticated content, to avoid UI flicker or incorrect states. For example:

const { data: session, isPending } = authClient.useSession();
if (isPending) return <Loader />;
if (!session) return <LoginPrompt />;
return <AuthenticatedApp />;

If you want a more robust solution, wrap your app in a custom SessionProvider that manages session state and loading, then use a custom useSession hook from that provider (example pattern). This approach helps prevent hydration mismatches and ensures your UI only renders when session state is resolved.

No recent code or config changes alter this behavior. If you see session: undefined and user: undefined, it’s likely because you’re destructuring the session object before checking if data is null—always check data first. This is not a bug, but a design choice for predictable state in React apps.

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

@dosubot[bot] commented on GitHub (Jan 20, 2026): <!-- Greeting --> Hi @vannamphuc! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is expected behavior in Better Auth. The useSession hook always returns an object for state management, but its data property is set to null when the user is not authenticated. There is no configuration to make useSession itself return null or undefined; instead, you should check if data is null to determine if the user is logged out. This pattern is intentional and matches how the session endpoint works on the server—if there’s no session, it returns null, and the client store’s data becomes null as well ([source](https://github.com/better-auth/better-auth/issues/4625)). Best practice is to check both isPending and data before rendering authenticated content, to avoid UI flicker or incorrect states. For example: ```tsx const { data: session, isPending } = authClient.useSession(); if (isPending) return <Loader />; if (!session) return <LoginPrompt />; return <AuthenticatedApp />; ``` If you want a more robust solution, wrap your app in a custom SessionProvider that manages session state and loading, then use a custom useSession hook from that provider ([example pattern](https://github.com/better-auth/better-auth/issues/4625)). This approach helps prevent hydration mismatches and ensures your UI only renders when session state is resolved. No recent code or config changes alter this behavior. If you see session: undefined and user: undefined, it’s likely because you’re destructuring the session object before checking if data is null—always check data first. This is not a bug, but a design choice for predictable state in React apps. <!-- 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/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/23041045-9fc1-4c3e-9172-c34509831ee0?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=This%20is%20expected%20behavior%20in%20Better%20Auth.%20The%20useSession%20hook%20always%20returns%20an%20object%20for%20state%20management%2C%20but%20its%20data%20property%20is%20set%20to%20null%20when%20the%20user%20is%20not%20authenticated.%20There%20is%20no%20configuration%20to%20make%20useSession%20itself%20return%20null%20or%20undefined%3B%20instead%2C%20you%20should%20check%20if%20data%20is%20null%20to%20determine%20if%20the%20user%20is%20logged%20out.%20This%20pattern%20is%20intentional%20and%20matches%20how%20the%20session%20endpoint%20works%20on%20the%20server%E2%80%94if%20there%E2%80%99s%20no%20session%2C%20it%20returns%20null%2C%20and%20the%20client%20store%E2%80%99s%20data%20becomes%20null%20as%20well%20%28%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/4625%29%29.%0A%0ABest%20practice%20is%20to%20check%20both%20isPending%20and%20data%20before%20rendering%20authenticated%20content%2C%20to%20avoid%20UI%20flicker%20or%20incorrect%20states.%20For%20example%3A%0A%0A%60%60%60tsx%0Aconst%20%7B%20data%3A%20session%2C%20isPending%20%7D%20%3D%20authClient.useSession%28%29%3B%0Aif%20%28isPending%29%20return%20%3CLoader%20/%3E%3B%0Aif%20%28%21session%29%20return%20%3CLoginPrompt%20/%3E%3B%0Areturn%20%3CAuthenticatedApp%20/%3E%3B%0A%60%60%60%0A%0AIf%20you%20want%20a%20more%20robust%20solution%2C%20wrap%20your%20app%20in%20a%20custom%20SessionProvider%20that%20manages%20session%20state%20and%20loading%2C%20then%20use%20a%20custom%20useSession%20hook%20from%20that%20provider%20%28%5Bexample%20pattern%5D%28https%3A//github.com/better-auth/better-auth/issues/4625%29%29.%20This%20approach%20helps%20prevent%20hydration%20mismatches%20and%20ensures%20your%20UI%20only%20renders%20when%20session%20state%20is%20resolved.%0A%0ANo%20recent%20code%20or%20config%20changes%20alter%20this%20behavior.%20If%20you%20see%20session%3A%20undefined%20and%20user%3A%20undefined%2C%20it%E2%80%99s%20likely%20because%20you%E2%80%99re%20destructuring%20the%20session%20object%20before%20checking%20if%20data%20is%20null%E2%80%94always%20check%20data%20first.%20This%20is%20not%20a%20bug%2C%20but%20a%20design%20choice%20for%20predictable%20state%20in%20React%20apps.)&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/7494)
Author
Owner

@vannamphuc commented on GitHub (Jan 20, 2026):

@dosu

For example with my login form

const form = useForm({
    defaultValues: {
      email: '',
      password: '',
    },
    validators: {
      onSubmit: loginSchema,
    },
    onSubmit: ({ value }) => {
      startTransition(async () => {
        await authClient.signIn.email({
          email: value.email,
          password: value.password,
          fetchOptions: {
            onSuccess: () => {
              toast.success('Logged in successfully')
              navigate({ to: '/dashboard' })
            },
            onError: ({ error }) => {
              toast.error(error.message)
            },
          },
        })
      })
    },
  })

I'm sending to signIn.email with data like this and i'm make sure it not right. But response of this still like this

{
    "email": "dadex19763@lawicon.com",
    "password": "123123123123123123123123123123"
}
Image
@vannamphuc commented on GitHub (Jan 20, 2026): [@dosu](https://go.dosu.dev/dosubot) For example with my login form ```jsx const form = useForm({ defaultValues: { email: '', password: '', }, validators: { onSubmit: loginSchema, }, onSubmit: ({ value }) => { startTransition(async () => { await authClient.signIn.email({ email: value.email, password: value.password, fetchOptions: { onSuccess: () => { toast.success('Logged in successfully') navigate({ to: '/dashboard' }) }, onError: ({ error }) => { toast.error(error.message) }, }, }) }) }, }) ``` I'm sending to signIn.email with data like this and i'm make sure it not right. But response of this still like this ```json { "email": "dadex19763@lawicon.com", "password": "123123123123123123123123123123" } ``` <img width="970" height="645" alt="Image" src="https://github.com/user-attachments/assets/50a5aef7-8238-4972-8e98-fa756209533c" />
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2026):

The Better Auth client never returns your submitted credentials (email and password) in the response—if you see them in devtools, that's just the request payload, not the server's reply. If the response is an HTML document instead of JSON, it usually means your request was redirected or didn't reach the expected API endpoint, often due to routing or CORS misconfiguration. Common causes include incorrect API URLs, CORS errors, or fetchOptions using 'no-cors' (which you should avoid) source.

Check the network tab for the signIn.email request: look at the response body, status code, and headers. If you see HTML, confirm your endpoint is correct, review CORS settings (make sure trustedOrigins and exposedHeaders are set properly), and ensure your backend isn't redirecting or returning a fallback page source. If you need to handle redirects, use fetchOptions.onSuccess to manually set window.location.href if context.response.redirected is true.

If you share the exact network response details (status code, headers, body), I can help you pinpoint the misconfiguration.

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

@dosubot[bot] commented on GitHub (Jan 20, 2026): <!-- Answer --> The Better Auth client never returns your submitted credentials (email and password) in the response—if you see them in devtools, that's just the request payload, not the server's reply. If the response is an HTML document instead of JSON, it usually means your request was redirected or didn't reach the expected API endpoint, often due to routing or CORS misconfiguration. Common causes include incorrect API URLs, CORS errors, or fetchOptions using `'no-cors'` (which you should avoid) [source](https://github.com/better-auth/better-auth/issues/6455). Check the network tab for the signIn.email request: look at the response body, status code, and headers. If you see HTML, confirm your endpoint is correct, review CORS settings (make sure `trustedOrigins` and `exposedHeaders` are set properly), and ensure your backend isn't redirecting or returning a fallback page [source](https://github.com/better-auth/better-auth/issues/1160). If you need to handle redirects, use `fetchOptions.onSuccess` to manually set `window.location.href` if `context.response.redirected` is true. If you share the exact network response details (status code, headers, body), I can help you pinpoint the misconfiguration. <!-- 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/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e22399df-780d-42b3-a97b-efe180f28f2d?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=The%20Better%20Auth%20client%20never%20returns%20your%20submitted%20credentials%20%28email%20and%20password%29%20in%20the%20response%E2%80%94if%20you%20see%20them%20in%20devtools%2C%20that%27s%20just%20the%20request%20payload%2C%20not%20the%20server%27s%20reply.%20If%20the%20response%20is%20an%20HTML%20document%20instead%20of%20JSON%2C%20it%20usually%20means%20your%20request%20was%20redirected%20or%20didn%27t%20reach%20the%20expected%20API%20endpoint%2C%20often%20due%20to%20routing%20or%20CORS%20misconfiguration.%20Common%20causes%20include%20incorrect%20API%20URLs%2C%20CORS%20errors%2C%20or%20fetchOptions%20using%20%60%27no-cors%27%60%20%28which%20you%20should%20avoid%29%20%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/6455%29.%0A%0ACheck%20the%20network%20tab%20for%20the%20signIn.email%20request%3A%20look%20at%20the%20response%20body%2C%20status%20code%2C%20and%20headers.%20If%20you%20see%20HTML%2C%20confirm%20your%20endpoint%20is%20correct%2C%20review%20CORS%20settings%20%28make%20sure%20%60trustedOrigins%60%20and%20%60exposedHeaders%60%20are%20set%20properly%29%2C%20and%20ensure%20your%20backend%20isn%27t%20redirecting%20or%20returning%20a%20fallback%20page%20%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/1160%29.%20If%20you%20need%20to%20handle%20redirects%2C%20use%20%60fetchOptions.onSuccess%60%20to%20manually%20set%20%60window.location.href%60%20if%20%60context.response.redirected%60%20is%20true.%0A%0AIf%20you%20share%20the%20exact%20network%20response%20details%20%28status%20code%2C%20headers%2C%20body%29%2C%20I%20can%20help%20you%20pinpoint%20the%20misconfiguration.)&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/7494)
Author
Owner

@vannamphuc commented on GitHub (Jan 20, 2026):

@dosu
Hello. Just a side note, I'm currently trying to build my project and it's giving me the following error.

    "better-auth": "^1.4.15",
node -v
v22.12.0
✗ Build failed in 15.11s
error during build:
node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js (15:34): "managedNonce" is not exported by "node_modules/@noble/ciphers/esm/utils.js", imported by "node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js".
file: C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js:15:34

13: import { SqliteDialect, MysqlDialect, PostgresDialect, MssqlDialect, Kysely, sql } from "kysely";
14: import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
15: import { utf8ToBytes, bytesToHex, managedNonce, hexToBytes as hexToBytes$1 } from "@noble/ciphers/utils.js";
                                      ^
16: import { betterFetch } from "@better-fetch/fetch";
17: import { JWTExpired } from "jose/errors";

    at getRollupError (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
    at error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:397:42)
    at Module.error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17022:16)
    at Module.traceVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17478:29)    
    at ModuleScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:15141:39)
    at ReturnValueScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38)
    at FunctionBodyScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38)
    at Identifier.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5462:40)
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)    
    at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:7421:19)    
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at ReturnStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)     
    at BlockStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)      
    at ArrowFunctionExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)
    at VariableDeclarator.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)  
    at VariableDeclaration.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) 
    at Program.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)
    at Module.bindReferences (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17001:18)   
    at Graph.sortModules (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22866:20)       
    at Graph.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22764:14)
    at async file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23455:13
    at async catchUnfinishedHookActions (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22925:16)
    at async rollupInternal (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23450:5)     
    at async buildEnvironment (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33541:12)      
    at async Object.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33900:19)
    at async buildEnvironments (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/nitro/dist/vite.mjs:118:2)
    at async Object.buildApp (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33894:5)        
    at async CAC.<anonymous> (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/cli.js:629:3)
@vannamphuc commented on GitHub (Jan 20, 2026): [@dosu](https://go.dosu.dev/dosubot) Hello. Just a side note, I'm currently trying to build my project and it's giving me the following error. ```note "better-auth": "^1.4.15", node -v v22.12.0 ``` ```terminal ✗ Build failed in 15.11s error during build: node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js (15:34): "managedNonce" is not exported by "node_modules/@noble/ciphers/esm/utils.js", imported by "node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js". file: C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js:15:34 13: import { SqliteDialect, MysqlDialect, PostgresDialect, MssqlDialect, Kysely, sql } from "kysely"; 14: import { xchacha20poly1305 } from "@noble/ciphers/chacha.js"; 15: import { utf8ToBytes, bytesToHex, managedNonce, hexToBytes as hexToBytes$1 } from "@noble/ciphers/utils.js"; ^ 16: import { betterFetch } from "@better-fetch/fetch"; 17: import { JWTExpired } from "jose/errors"; at getRollupError (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:401:41) at error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:397:42) at Module.error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17022:16) at Module.traceVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17478:29) at ModuleScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:15141:39) at ReturnValueScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38) at FunctionBodyScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38) at Identifier.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5462:40) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:7421:19) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) at ReturnStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at BlockStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) at ArrowFunctionExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at VariableDeclarator.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) at VariableDeclaration.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) at Program.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) at Module.bindReferences (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17001:18) at Graph.sortModules (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22866:20) at Graph.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22764:14) at async file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23455:13 at async catchUnfinishedHookActions (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22925:16) at async rollupInternal (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23450:5) at async buildEnvironment (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33541:12) at async Object.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33900:19) at async buildEnvironments (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/nitro/dist/vite.mjs:118:2) at async Object.buildApp (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33894:5) at async CAC.<anonymous> (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/cli.js:629:3) ```
Author
Owner

@dosubot[bot] commented on GitHub (Jan 20, 2026):

This build error happens because Better Auth v1.4.15 expects @noble/ciphers v2.x, which is ESM-only. If your build setup (like Vite/Nitro) or any dependency tries to use CommonJS, or if there’s a version mismatch or corrupted install, you’ll get the “managedNonce is not exported” error. This is a known issue with ESM-only dependencies and static imports in some build environments see details and here.

Here’s how to resolve it:

  1. Make sure your installed @noble/ciphers is ^2.0.0 (check node_modules/@noble/ciphers/package.json).
  2. Delete node_modules and your lockfile (package-lock.json or pnpm-lock.yaml), then reinstall everything.
  3. Audit your imports: in client code, only import from better-auth/client and better-auth/client/plugins—never from the default better-auth entrypoint or server-only modules.
  4. If you’re still stuck, upgrade to the latest beta (1.4.7-beta.4 or newer)—users report this resolves the build error and related warnings in TanStack Start projects see user reports.
  5. If you can’t use the beta, downgrade to 1.4.5 as a temporary workaround.

This is a known ESM/CommonJS compatibility issue. If you still see the error after these steps, share your lockfile and I can help you dig deeper.

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

@dosubot[bot] commented on GitHub (Jan 20, 2026): <!-- Answer --> This build error happens because Better Auth v1.4.15 expects `@noble/ciphers` v2.x, which is ESM-only. If your build setup (like Vite/Nitro) or any dependency tries to use CommonJS, or if there’s a version mismatch or corrupted install, you’ll get the “managedNonce is not exported” error. This is a known issue with ESM-only dependencies and static imports in some build environments [see details](https://github.com/better-auth/better-auth/issues/4531) [and here](https://github.com/better-auth/better-auth/pull/4433). Here’s how to resolve it: 1. Make sure your installed `@noble/ciphers` is `^2.0.0` (check `node_modules/@noble/ciphers/package.json`). 2. Delete `node_modules` and your lockfile (`package-lock.json` or `pnpm-lock.yaml`), then reinstall everything. 3. Audit your imports: in client code, only import from `better-auth/client` and `better-auth/client/plugins`—never from the default `better-auth` entrypoint or server-only modules. 4. If you’re still stuck, upgrade to the latest beta (`1.4.7-beta.4` or newer)—users report this resolves the build error and related warnings in TanStack Start projects [see user reports](https://github.com/better-auth/better-auth/issues/6637). 5. If you can’t use the beta, downgrade to `1.4.5` as a temporary workaround. This is a known ESM/CommonJS compatibility issue. If you still see the error after these steps, share your lockfile and I can help you dig deeper. <!-- 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/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/aed59dd4-ba57-40a6-be61-d5b3a0d59150?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=This%20build%20error%20happens%20because%20Better%20Auth%20v1.4.15%20expects%20%60%40noble/ciphers%60%20v2.x%2C%20which%20is%20ESM-only.%20If%20your%20build%20setup%20%28like%20Vite/Nitro%29%20or%20any%20dependency%20tries%20to%20use%20CommonJS%2C%20or%20if%20there%E2%80%99s%20a%20version%20mismatch%20or%20corrupted%20install%2C%20you%E2%80%99ll%20get%20the%20%E2%80%9CmanagedNonce%20is%20not%20exported%E2%80%9D%20error.%20This%20is%20a%20known%20issue%20with%20ESM-only%20dependencies%20and%20static%20imports%20in%20some%20build%20environments%C2%A0%5Bsee%20details%5D%28https%3A//github.com/better-auth/better-auth/issues/4531%29%C2%A0%5Band%20here%5D%28https%3A//github.com/better-auth/better-auth/pull/4433%29.%0A%0AHere%E2%80%99s%20how%20to%20resolve%20it%3A%0A%0A1.%20Make%20sure%20your%20installed%20%60%40noble/ciphers%60%20is%20%60%5E2.0.0%60%20%28check%20%60node_modules/%40noble/ciphers/package.json%60%29.%0A2.%20Delete%20%60node_modules%60%20and%20your%20lockfile%20%28%60package-lock.json%60%20or%20%60pnpm-lock.yaml%60%29%2C%20then%20reinstall%20everything.%0A3.%20Audit%20your%20imports%3A%20in%20client%20code%2C%20only%20import%20from%20%60better-auth/client%60%20and%20%60better-auth/client/plugins%60%E2%80%94never%20from%20the%20default%20%60better-auth%60%20entrypoint%20or%20server-only%20modules.%0A4.%20If%20you%E2%80%99re%20still%20stuck%2C%20upgrade%20to%20the%20latest%20beta%20%28%601.4.7-beta.4%60%20or%20newer%29%E2%80%94users%20report%20this%20resolves%20the%20build%20error%20and%20related%20warnings%20in%20TanStack%20Start%20projects%C2%A0%5Bsee%20user%20reports%5D%28https%3A//github.com/better-auth/better-auth/issues/6637%29.%0A5.%20If%20you%20can%E2%80%99t%20use%20the%20beta%2C%20downgrade%20to%20%601.4.5%60%20as%20a%20temporary%20workaround.%0A%0AThis%20is%20a%20known%20ESM/CommonJS%20compatibility%20issue.%20If%20you%20still%20see%20the%20error%20after%20these%20steps%2C%20share%20your%20lockfile%20and%20I%20can%20help%20you%20dig%20deeper.)&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/7494)
Author
Owner

@himself65 commented on GitHub (Jan 20, 2026):

@dosu

For example with my login form

const form = useForm({
defaultValues: {
email: '',
password: '',
},
validators: {
onSubmit: loginSchema,
},
onSubmit: ({ value }) => {
startTransition(async () => {
await authClient.signIn.email({
email: value.email,
password: value.password,
fetchOptions: {
onSuccess: () => {
toast.success('Logged in successfully')
navigate({ to: '/dashboard' })
},
onError: ({ error }) => {
toast.error(error.message)
},
},
})
})
},
})
I'm sending to signIn.email with data like this and i'm make sure it not right. But response of this still like this

{
"email": "dadex19763@lawicon.com",
"password": "123123123123123123123123123123"
}
Image

Setup CORS

@himself65 commented on GitHub (Jan 20, 2026): > [@dosu](https://go.dosu.dev/dosubot) > > For example with my login form > > const form = useForm({ > defaultValues: { > email: '', > password: '', > }, > validators: { > onSubmit: loginSchema, > }, > onSubmit: ({ value }) => { > startTransition(async () => { > await authClient.signIn.email({ > email: value.email, > password: value.password, > fetchOptions: { > onSuccess: () => { > toast.success('Logged in successfully') > navigate({ to: '/dashboard' }) > }, > onError: ({ error }) => { > toast.error(error.message) > }, > }, > }) > }) > }, > }) > I'm sending to signIn.email with data like this and i'm make sure it not right. But response of this still like this > > { > "email": "dadex19763@lawicon.com", > "password": "123123123123123123123123123123" > } > <img alt="Image" width="970" height="645" src="https://private-user-images.githubusercontent.com/127393321/538157887-50a5aef7-8238-4972-8e98-fa756209533c.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg5NDE5MTIsIm5iZiI6MTc2ODk0MTYxMiwicGF0aCI6Ii8xMjczOTMzMjEvNTM4MTU3ODg3LTUwYTVhZWY3LTgyMzgtNDk3Mi04ZTk4LWZhNzU2MjA5NTMzYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMTIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDEyMFQyMDQwMTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yMGJiNzYwYzRhMGQ2OWQyYTM0MWVmODIzMWVmMTZlNDVhMzU3YWM1MTM4OGY2YmY3YWJlNjk5MzA5YTY4OWY4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.oUN09UB2t4HTfWXtfp1y8JNeLQskHl1yYWqbWeD0qiU"> Setup CORS
Author
Owner

@himself65 commented on GitHub (Jan 20, 2026):

@dosu Hello. Just a side note, I'm currently trying to build my project and it's giving me the following error.

    "better-auth": "^1.4.15",
node -v
v22.12.0
✗ Build failed in 15.11s
error during build:
node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js (15:34): "managedNonce" is not exported by "node_modules/@noble/ciphers/esm/utils.js", imported by "node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js".
file: C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js:15:34

13: import { SqliteDialect, MysqlDialect, PostgresDialect, MssqlDialect, Kysely, sql } from "kysely";
14: import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
15: import { utf8ToBytes, bytesToHex, managedNonce, hexToBytes as hexToBytes$1 } from "@noble/ciphers/utils.js";
                                      ^
16: import { betterFetch } from "@better-fetch/fetch";
17: import { JWTExpired } from "jose/errors";

    at getRollupError (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
    at error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:397:42)
    at Module.error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17022:16)
    at Module.traceVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17478:29)    
    at ModuleScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:15141:39)
    at ReturnValueScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38)
    at FunctionBodyScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38)
    at Identifier.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5462:40)
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)    
    at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:7421:19)    
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)      
    at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15)     
    at ReturnStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)     
    at BlockStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)      
    at ArrowFunctionExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)
    at VariableDeclarator.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23)  
    at VariableDeclaration.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) 
    at Program.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28)
    at Module.bindReferences (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17001:18)   
    at Graph.sortModules (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22866:20)       
    at Graph.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22764:14)
    at async file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23455:13
    at async catchUnfinishedHookActions (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22925:16)
    at async rollupInternal (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23450:5)     
    at async buildEnvironment (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33541:12)      
    at async Object.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33900:19)
    at async buildEnvironments (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/nitro/dist/vite.mjs:118:2)
    at async Object.buildApp (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33894:5)        
    at async CAC.<anonymous> (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/cli.js:629:3)

Check your lock file, try to cleanup node_modules

@himself65 commented on GitHub (Jan 20, 2026): > [@dosu](https://go.dosu.dev/dosubot) Hello. Just a side note, I'm currently trying to build my project and it's giving me the following error. > > ``` > "better-auth": "^1.4.15", > node -v > v22.12.0 > ``` > > ``` > ✗ Build failed in 15.11s > error during build: > node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js (15:34): "managedNonce" is not exported by "node_modules/@noble/ciphers/esm/utils.js", imported by "node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js". > file: C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/.nitro/vite/services/ssr/assets/auth-2F6PC1rL.js:15:34 > > 13: import { SqliteDialect, MysqlDialect, PostgresDialect, MssqlDialect, Kysely, sql } from "kysely"; > 14: import { xchacha20poly1305 } from "@noble/ciphers/chacha.js"; > 15: import { utf8ToBytes, bytesToHex, managedNonce, hexToBytes as hexToBytes$1 } from "@noble/ciphers/utils.js"; > ^ > 16: import { betterFetch } from "@better-fetch/fetch"; > 17: import { JWTExpired } from "jose/errors"; > > at getRollupError (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:401:41) > at error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/parseAst.js:397:42) > at Module.error (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17022:16) > at Module.traceVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17478:29) > at ModuleScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:15141:39) > at ReturnValueScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38) > at FunctionBodyScope.findVariable (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5688:38) > at Identifier.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:5462:40) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) > at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at MemberExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:7421:19) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) > at CallExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:12172:15) > at ReturnStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at BlockStatement.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) > at ArrowFunctionExpression.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at VariableDeclarator.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2829:23) > at VariableDeclaration.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) > at Program.bind (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:2825:28) > at Module.bindReferences (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:17001:18) > at Graph.sortModules (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22866:20) > at Graph.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22764:14) > at async file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23455:13 > at async catchUnfinishedHookActions (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:22925:16) > at async rollupInternal (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/rollup/dist/es/shared/node-entry.js:23450:5) > at async buildEnvironment (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33541:12) > at async Object.build (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33900:19) > at async buildEnvironments (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/nitro/dist/vite.mjs:118:2) > at async Object.buildApp (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/chunks/config.js:33894:5) > at async CAC.<anonymous> (file:///C:/Users/phucn/Downloads/Code/tanstack-start/node_modules/vite/dist/node/cli.js:629:3) > ``` Check your lock file, try to cleanup node_modules
Author
Owner

@himself65 commented on GitHub (Jan 20, 2026):

Please provide a reproducible code so we can try

@himself65 commented on GitHub (Jan 20, 2026): Please provide a reproducible code so we can try
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2739