Better AuthBA
Better Auth2mo ago
1 reply
imKK

tanstackStartCookies Plugin Causes Some Vite Pre-bundle Error in TanStack Start

I set up a minimal TanStack Start app using the official quick start: https://tanstack.com/start/latest/docs/framework/react/quick-start
Then I integrated Better Auth exactly as per the docs:
Installation: https://www.better-auth.com/docs/installation
Basic Usage: https://www.better-auth.com/docs/basic-usage
TanStack Integration: https://www.better-auth.com/docs/integrations/tanstack

Code wise it's the exact same and default as in the docs.

Getting errors like this as I added the tanstackStartCookies plugin and eventually crashing

Error: There is a new version of the pre-bundle for "/Users/me/Desktop/projects/test/node_modules/.vite/deps_ssr/better-auth_tanstack-start.js?v=1a5317b4", a page reload is going to ask for it.
    at CustomModuleRunner.cachedModule (workers/runner-worker.js:1264:20)
    ... 8 lines matching cause stack trace ...
    at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1143:73) {
  cause: Error: There is a new version of the pre-bundle for "/Users/me/Desktop/projects/test/node_modules/.vite/deps_ssr/better-auth_tanstack-start.js?v=1a5317b4", a page reload is going to ask for it.
      at CustomModuleRunner.cachedModule (workers/runner-worker.js:1264:20)
      at request (workers/runner-worker.js:1182:83)
      at /Users/me/Desktop/projects/test/src/lib/auth.ts:3:1
      at Object.runInlinedModule (workers/runner-worker.js:1365:4)
      at CustomModuleRunner.directRequest (workers/runner-worker.js:1236:59)
      at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1143:73)
      at /Users/me/Desktop/projects/test/src/routes/api/auth/$.ts:2:1
      at Object.runInlinedModule (workers/runner-worker.js:1365:4)
      at CustomModuleRunner.directRequest (workers/runner-worker.js:1236:59)
      at CustomModuleRunner.cachedRequest (workers/runner-worker.js:1143:73) {
    remote: true
  },
  status: 500,
  statusText: undefined,
  headers: undefined,
  data: undefined,
  body: undefined,
  unhandled: true
} (x2)
Impatient? The fastest way to get a Start project up and running is with the cli. Just run pnpm create @tanstack/start@latest or npm create @tanstack/start@latest depending on your package manager of...
Quick Start | TanStack Start React Docs
Learn how to configure Better Auth in your project.
Installation | Better Auth
Getting started with Better Auth
Basic Usage | Better Auth
Integrate Better Auth with TanStack Start.
TanStack Start Integration | Better Auth
Was this page helpful?