TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

absent-sapphire
absent-sapphire10/3/2025

Environment variables best practices

In one example here (https://tanstack.com/start/latest/docs/framework/react/execution-model), I noticed a code snipped saying to use createServerOnlyFn to return an environment variable so that it's not accidentally leaked to the client. However, in another section (https://tanstack.com/start/latest/docs/framework/react/environment-variables) it says that env variables aren't even accessible in client code unless the name is prefixed with VITE_. I'm struggling to understand in which circumstance each solution is supposed to be used, as from my understanding they both result in the same end functionality of the variable being withheld from the client bundle. Can anyone shed some light on this and help me understand the specific cases in which one approach should be preffered? Thanks!...
old-apricot
old-apricot10/3/2025

Delay Loading Page on Vercel

This isn't something I notice when I'm running in development mode. But when we deploy to Vercel, the first time we load the app, or any time we try to refresh (so I guess any time it goes to the server for a route), we get a 10 second delay before everything rushes in. I'm struggling to debug it because I don't really get any logs. I've got a suspicion it could be to do with Clerk because there is a route that is not authenticated, and I don't think it's having the same issue, but it also doesn't do a lot. There's nothing in the browser recording of the requests because it's all in the single request to that route, not in any of the server function calls. the browser just sort of sits on a white page for 10 seconds and then everything rushes in as it does the extra calls. Has anyone experienced anything like this or have any sort of suggestions on where I could start to look?...
harsh-harlequin
harsh-harlequin10/3/2025

Server Routes / Functions not working properly

Hi, I'm having an issue with using serverOnly() and createServerFileRoute. I've been using them for awhile in my codebase, but suddently after updating, errors are being thrown at me saying serverOnly doesn't exist, or createServerFileRoute doesn't exist. This worked error free not even 2 days ago, but now I can't get it to even spin up in a dev environment because all my server API routes are using that (I'm using the tanstack starter template with better auth / vite). Also getting a ton of route piece errors for ALL api routes, but never got them before. New to ts development so not sure what I'm doing wrong. I asked chatgpt but it said to define my routes with GET POST or something like that, but i alredy have, for example ...
wise-white
wise-white10/3/2025

Cannot make react context work during SSR

I made a simple ThemeContext, I have a providers file which is loading all the providers. ``` function RootDocument({ children }: { children: ReactNode }) { return (...
exotic-emerald
exotic-emerald10/3/2025

Build & Preview 404

run into a 404 at the preview mode. defined the app as SPA. spa: { enabled: true } Cannot GET / can anyone support me?...
rival-black
rival-black10/3/2025

Server function middleware's aren't receiving the request object

Could someone help me out here, think I might be missing something obvious. I would expect this middleware to log out the request object so it can be used for authentication etc. ``` import { createMiddleware, createServerFn } from '@tanstack/react-start'; ...
passive-yellow
passive-yellow10/3/2025

type broken on useServerFn?

Sorry for the AI generated summary, but just wanted a clean reproducible version of the issue: ```import { useMutation } from "@tanstack/react-query"; import { useServerFn } from "@tanstack/react-start"; ...
fair-rose
fair-rose10/3/2025

SSR environment is not ready

What is the reason for this error after deployment? SSR environment is not ready
metropolitan-bronze
metropolitan-bronze10/2/2025

Claude Code can't run tanstack start in it's bash

Is this happening to anyone else? If I have claude code run localhost it just ends closes the bash instantly. I'm using tanstack db electric collections in case that's flagging claude code for some reason and it's killing it. But anyone else have this issue right now?...
rival-black
rival-black10/2/2025

How to throw a error in a middleware and catch it on parent middleware

I have 2 middleware like the image, but A middleware is not catching anything and the Error is sending to client but it fails because a class is not serializable g [Error]: The value [object Object] of type "object" cannot be parsed/serialized....
No description
eastern-cyan
eastern-cyan10/2/2025

How to access nonce in Middleware?

How can we access the nonce introduced in https://github.com/TanStack/router/pull/5287 in Middleware .server context, so that we can properly set the CSP header?
rival-black
rival-black10/2/2025

Where is staticFunctionMiddleware

I am trying to follow Static Server Functions, however i can't as staticFunctionMiddleware cannot be found anywhere. Is there any smart import to do? Or other library to install? Or some module augmentation?
correct-apricot
correct-apricot10/2/2025

@netlify/vite-plugin-tanstack-start' breaking hmr refresh?

Hi, ``` "@tanstack/react-router": "^1.132.31", "@tanstack/react-router-devtools": "^1.132.31",...
xenial-black
xenial-black10/2/2025

Need Help

I keep getting the below error each time i make changes and save on my code editor, is it something i should be worried off `[vite] program reload [vite] An error happened during full reload Failed to load url tanstack-start-server-entry.ts (resolved id: tanstack-start-server-entry.ts). Does the file exist?...
rival-black
rival-black10/2/2025

What is the purpose of useServerFn, all works without it

At What are Server Functions? page we have example of server function that can be used with useQuery (from TanStack Query, to fetch data from endpoint). Example is as follows: ``` const getServerPosts = createServerFn().handler(async () => {...});...
adverse-sapphire
adverse-sapphire10/2/2025

Why does throwing a redirect in the route loaders post RC trigger an error?

I've successfully upgraded a codebase to RC before I noticed something that wasn't there pre-RC. The router docs clearly say that you can throw a redirect from the beforeLoad or loader fn of a route. Now, on RC, throwing redirects from the loaders trigger an error. Maybe I'm making a mistake somewhere. Why is this happening and how can I resolve it?
No description
wise-white
wise-white10/1/2025

useParams is not propagating

Hi so we finally updated to the latest version of Tanstack Start ... but are experiencing follow problem: ```ts import { createFileRoute, Outlet } from "@tanstack/react-router"; import { BaseLayout } from "~/templates/layout/BaseLayout";...
adverse-sapphire
adverse-sapphire10/1/2025

Cannot access ServerFns

GET http://localhost:3000/customScript.js net::ERR_ABORTED 404 (Not Found)Understand this error createClientRpc.js?v=5d579772:9 Uncaught (in promise) ReferenceError: process is not defined at createClientRpc (createClientRpc.js?v=5d579772:9:43) at __root.tsx:26:1 ...
correct-apricot
correct-apricot10/1/2025

Start RC -> Failed to load the ES module

Hi, code that was working OK inside Start 1.31 is now showing an error in the logs. https://68dcdf7e5058d6c68105c80c--momnium.netlify.app/ The strange thing is that if the page is loaded directly from the address bar it loads ok. But if I navigate to a route using a link, I get this error. But if I refresh it loads....