Repository navigation
api route not found throws 404 #4873
Copy link
Copy link
Closed
Labels
information neededFurther information is requestedFurther information is requested
Description
Which project does this relate to?
Start
Describe the bug
Initially I tried to build tanstack start app from scratch. I followed the documentation. When I created api route in routes/api/start.ts using createServerFileRoute then I called the endpoint in the component route. I see 404 being thrown.
So I tried with the example repo, examples/react/start-basic-react-query, when I run the app I see the same issue in the repo as well.
http://localhost:3000/api/users
Response:
<html>
<head>
<script class='$tsr'>
(self.$R = self.$R || {})["tsr"] = [];
self.$_TSR = {
c: () => {
document.querySelectorAll(".\\$tsr").forEach(e => {
e.remove()
}
)
}
};
;$_TSR["router"] = ($R => $R[0] = {
manifest: $R[1] = {
routes: $R[2] = {
__root__: $R[3] = {
preloads: void 0,
assets: $R[4] = [$R[5] = {
tag: "script",
attrs: $R[6] = {
type: "module",
suppressHydrationWarning: !0,
async: !0
},
children: "import { injectIntoGlobalHook } from \"/@react-refresh\";\ninjectIntoGlobalHook(window);\nwindow.$RefreshReg$ = () => {};\nwindow.$RefreshSig$ = () => (type) => type;;;import('/~start/default-client-entry')"
}]
}
},
clientEntry: "/~start/default-client-entry"
},
matches: $R[7] = [$R[8] = {
i: "__root__",
u: 1754457363999,
s: "success",
ssr: !0
}],
lastMatchId: "__root__",
dehydratedData: void 0
})($R["tsr"]);
if (typeof $_TSR !== 'undefined')
$_TSR.c()
</script>
<meta charSet="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TanStack Start Starter</title>
</head>
<body>
<p>Not Found</p>
<script type="module" async="">
import {injectIntoGlobalHook} from "/@react-refresh";
injectIntoGlobalHook(window);
window.$RefreshReg$ = () => {}
;
window.$RefreshSig$ = () => (type) => type;
;;import('/~start/default-client-entry')
</script>
</body>
</html>
Your Example Website or App
https://stackblitz.com/~/github.com/TanStack/router
Steps to Reproduce the Bug or Issue
- Clone the repo https://github.com/TanStack/router/tree/main/examples/react/start-basic-react-query
- Install and run the app
- Navigate to
/userspage - You would see
404in the Network tab
Expected behavior
As a user, I should not be seeing 404 and the users route should work as expected
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.130.15
- OS: macOS
- Browser: Chrome
- Browser Version: 138
- Bundler: vite
- Bundler Version: 6.3.5
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
information neededFurther information is requestedFurther information is requested
Activity
brenelz commentedon Aug 8, 2025
From my quick test it seems that for the tanstack router example you linked it does show the users correctly
schiller-manuel commentedon Sep 23, 2025
server route handling changed in RC, please see the docs https://tanstack.com/start/latest/docs/framework/react/server-routes
if there still is a problem, please open a new github issue