Auth throwing errors
I just created fresh project with
npm create @tanstack/start@latest -o tanstack-start-auth-test.
Then added auth accordingly to Authentication.
Ended up with a project that i zipped and attached here.
When trying to run npm run build i get
4 Replies
like-gold•2mo ago
in this case, in
src/authFunctions.ts exports both server functions (created via createServerFn) as well as export const useAppSession =... which made use of a server only functionality coming from @tanstack/react-start/server
since that function was exported, it cannot be removed when compiling the server functions.
removing export from that function makes it work
we will make this better discoverable soon during dev and prod buildlike-goldOP•2mo ago
useSession is server only? or isomorphic?
like-gold•2mo ago
server only
needs access to headers / cookies
like-goldOP•2mo ago
oh ok, so it was kind of exposed with server function (endpoints)
as i understand it
and btw, docs need updating on auth , they suggest usage session.get('userId'). now it is strongly typed with session.data.userId
and loginFn from the example gave me the following error on the "throw redirect"