TanStack Start SSR + Cookie Auth Issue - Need Advice
Hi! I'm facing an SSR authentication issue with TanStack Start and would love some feedback on my solution.
The Problem
I'm using TanStack Start with cookie-based authentication. Client-side navigation works perfectly, but SSR fails because server-side requests don't include browser cookies.
Working: Client navigation (cookies auto-included)
Broken: Hard refresh/direct URLs (SSR can't access cookies)
My Proposed Solution
Using createIsomorphicFn.
Then just change imports in my fetchers:
Questions
1. Is this the right approach for TanStack Start SSR + cookies?
2. Any gotchas I should be aware of with this solution?
3. Better alternatives? (I need to keep swagger-typescript-api and httpOnly cookies)
The Problem
I'm using TanStack Start with cookie-based authentication. Client-side navigation works perfectly, but SSR fails because server-side requests don't include browser cookies.
Working: Client navigation (cookies auto-included)
Broken: Hard refresh/direct URLs (SSR can't access cookies)
My Proposed Solution
Using createIsomorphicFn.
Then just change imports in my fetchers:
Questions
1. Is this the right approach for TanStack Start SSR + cookies?
2. Any gotchas I should be aware of with this solution?
3. Better alternatives? (I need to keep swagger-typescript-api and httpOnly cookies)