reactStartCookies plugin make tanstack build fails
Hello 👋
I'm trying to use better-auth with tanstack start but with a separate backend (a nestjs api).
Following the documentation and using the plugin for cookies:
this makes the build (with vite) fails with the following message:
After digging the code of the plugin, it seems that vite fails to correctly split the client and server bundles, because the plugin is using server side functions (like getCookie) that are only available on the server (not the client).
I have create a minimal repository here : https://github.com/Oupsla/tanstack-better-auth-build-bug
You can check that the build is failing, and just removing the plugin makes the build passing.
Is anyone succeed to use tanstack plugin with a separate backend ?
Thank you !
GitHub
GitHub - Oupsla/tanstack-better-auth-build-bug
Contribute to Oupsla/tanstack-better-auth-build-bug development by creating an account on GitHub.
7 Replies
@Oupsla did you figure this out?
I thought i was the only one who had this issue
i am using just tanstack start but have encountered a similar error with vite being unable to split between server and client
Ops error is because they are using
reactStartCookies
on the authClient
, it's meant to be used server-side with auth
, see hereTanStack Start Integration | Better Auth
Integrate Better Auth with TanStack Start.
ive been talking with some people in the tanstack server and i think this is a more general issue from a new release
not betterauth's fault
the steps are slightly different in RC
this looks okay re better-auth stuff https://github.com/dotnize/react-tanstarter
GitHub
GitHub - dotnize/react-tanstarter: 🏝️ minimal TanStack Start t...
🏝️ minimal TanStack Start template with Better Auth, Drizzle ORM, shadcn/ui - dotnize/react-tanstarter
the
$.tsx
syntax has changed and you shouldn't need a src/server.ts
file, this is assuming you've updated the non better auth stuff