[1.4.0-beta.21] importing `better-auth/react-start` crashes `vite dev` on a cold build
hi! first of all, thanks for all the amazing work on this library :)
i was having issues doing a fresh build of my barebones tanstack start app. commenting out the
reactStartCookies plugin seemed to fix it.
interestingly, the issue seems to be in the actual better-auth/react-start module and not the plugin. any import of the module (that doesn't get removed by vite) causes a bunch of the following errors in the console:
the same error repeats for a few modules (#tanstack-router-entry, #tanstack-start-entry, tanstack-start-manifest:v, tanstack-start-injected-head-scripts:v)
as far as i can tell, tanstack-start/tanstack-router throw these obtuse errors when you try to access client-only code in server code (or vice versa) in the body of a module during build time. so i suspect it's something related to that.
weirdly, it seems to happen only on a totally clean build. (i was deleting node_modules and reinstalling before each run, but i think clearing the vite cache with e.g. vite dev --force might work as well.) once i get a build working, if i comment the plugin back in, it usually works.
macOS Tahoe 26.1
nodejs 25.2.0
pnpm 10.22.0
sorry that's kind of a vague report. let me know if i can give any more info!18 Replies
jsut opened a pr
seems like they changed the import path for setCookie
try out the pr version
lmk if it fixes your issue
I'll comment in the PR the correct import path
@tanstack/react-start-server - i think it fixes it as now i have the error below, not sure if its related to this tanstack-start import issue
Other users also reported this issue when importing better auth https://github.com/TanStack/router/issues/5795
GitHub
Could not resolve "#tanstack-router-entry" · Issue #5795 · TanSta...
Which project does this relate to? Start Describe the bug I'm out of town this weekend but was running into this so wanted to file this bug report sooner than later. I'm using alchemy, whic...
can you please check now if it's the right import - cc @DiamondDragon
This should be the right import https://github.com/better-auth/better-auth/pull/6045#discussion_r2540931306
GitHub
feat: move react-start to tanstack-start by Bekacru · Pull Request...
Summary by cubic
Fix the TanStack setCookie import by switching from "@tanstack/start-server-core" to "@tanstack/start-server" in packages/better-auth/src/integr...
thanks so much for the quick turnaround!
unfortunately, i can't test the actual PR locally (issue with pnpm + git dependency + monorepo)... but i tried
pnpm patch better-auth and updated the import as in the PR (@tanstack/start-server-core -> @tanstack/react-start/server). that definitely fixed it!
so the PR is merged but i can't find the commit or changes in canary 🥴 might be some CI/CD weirdness that i'm missing but just wanted to flag in case there's an issue!our builds were failing with the same error
had to revert
looking into it
Experiencing similar issue with the newly released
v1.4.0 as wellwe haven't change the path
as it was breaking for us on build
taking a look into it
Oh gotcha! Sounds good 🤝
If it helps, I tried similarly just now as above with
bun patch The only diff from https://github.com/better-auth/better-auth/pull/6045/file (for tanstack start changes) is that the package.json I have locally in the patch is that the dependency changes use @tanstack/react-start/server instead of @tanstack/react-start-server. And that seems to work for me locally!
The usage in integrations on that PR has the proper path to use setCookie but the deps are referencing the incorrect pathcc @Taesu can you look into this
okay 👌
I noticed in the PR, shouldn't it only be
@tanstack/react-start?
Isn't @tanstack/start a deprecated package that was before they supported other frameworks? nobody uses this package anymore afaik
1.4 is pretty much unusable for tanstack start right now
could you try
1.4.1-beta.1?Nice!
1.4.1-beta.1 seems to be working for me! Appreciate the quick turn around / fixes here!I am having similar issues with 1.4 as well
thanks! works great now
^1.4.1-beta.1 fixes this