T
TanStack6mo ago
genetic-orange

503 error adding API routes

I'm running latest version of all packages and when I try to add API routes per the docs the app blows up with this error:
TypeError: Cannot read properties of undefined (reading 'update')
at eval (apps/web/src/routeTree.gen.ts:6:46)
...
TypeError: Cannot read properties of undefined (reading 'update')
at eval (apps/web/src/routeTree.gen.ts:6:46)
...
This occurs immediately after adding src/routes/api.ts per the docs:
import {
createStartAPIHandler,
defaultAPIFileRouteHandler,
} from "@tanstack/react-start/api";

export default createStartAPIHandler(defaultAPIFileRouteHandler);
import {
createStartAPIHandler,
defaultAPIFileRouteHandler,
} from "@tanstack/react-start/api";

export default createStartAPIHandler(defaultAPIFileRouteHandler);
Adding a basic API route doesn't make any difference. I've tried removing the routeTree.gen.ts, restarting, etc. but nothing seems to get me past this.
2 Replies
plain-purple
plain-purple6mo ago
don't put that file in the routed folder put it next to ssr.tsx
genetic-orange
genetic-orangeOP6mo ago
🤦‍♂️ thanks for saving me again @Manuel Schiller

Did you find this page helpful?