T
TanStack8h ago
sensitive-blue

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 export const ServerRoute = createServerFileRoute("/api/signup/approved/$").methods({ POST: async ({ request }: { request: Request }) => {
4 Replies
sensitive-blue
sensitive-blueOP8h ago
I've done some digging, apparently @tanstack/react-start/server isn't exported by tanstact in the node modules? I thought okay well ill just use the API route handler, and it says that isn't a thing either. but it definitely is? I'm so confused I did just transfer my codebase into a monorepo, just moved the entire thing to apps/web, in the root I have the workspace ofc and a package.json here, but sure what the issue is though I looked into the actual node modules and I see that it's exported, but the server isn't picking up on it. I've deleted all cache, node modules, restarted IDE and even my computer, nothing working still.
absent-sapphire
absent-sapphire7h ago
GitHub
Start BETA - Tracking · TanStack router · Discussion #2863
Tracking any important changes for TanStack Start during the BETA period. If you are coming from the ALPHA of TanStack Start, you can see all the breaking changes that were made here - #2403
sensitive-blue
sensitive-blueOP5h ago
omg thank you ive been wondering what went wrong When updating from using the .methods to the Unified routes, I've been having this issue Argument of type '"/api/income/withdraw"' is not assignable to parameter of type 'keyof FileRoutesByPath | undefined' errors. It isn't just withdraw, all of my API routes have this issue after updating apps\web\src\routes\api\income\withdraw.ts is the file path, not sure what went wrong?
absent-sapphire
absent-sapphire4h ago
did you run the dev server?

Did you find this page helpful?