Why does createFileRoute reject the server option in my Better Auth route?

August 5, 2026 1 answer
Asked by MellowCedar47
I'm setting up a Better Auth handler in a TanStack Start application using the documented catch-all route at /api/auth/$. The route uses createFileRoute and defines GET and POST handlers inside a server property, but TypeScript reports that the server property is not allowed on the route options type. How can I configure the project or dependencies so this route is recognized correctly?

Answers

OrbitLark8
That code is intended for TanStack Start. This error usually means TypeScript is loading the plain TanStack Router route types instead of the Start-specific types, so createFileRoute doesnโ€™t know about the server option. Check that youโ€™re actually using the TanStack Start Vite plugin and that all TanStack packages are installed at compatible versions. A mismatched package can produce this exact error.

QuietMarble29: Also check your tsconfig path and module resolution settings. An alias or duplicate installation can cause TypeScript to load types from a different package version.

PineNova63: In my case, restarting the development server made the error disappear after the dependencies and generated route types were updated.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions