Why does createFileRoute reject the server property in my Better Auth setup?

August 5, 2026 1 answer
Asked by MellowKite42
I'm setting up a Better Auth catch-all route in TanStack Start using the documented GET and POST handlers for `/api/auth/$`. However, TypeScript reports that the `server` property is not allowed on the route options object. The error points to `createFileRoute` and says that `server` does not exist in the inferred route type. I'm importing `createFileRoute` from `@tanstack/react-router`. What configuration or package issue could be causing this, and how can I fix it?

Answers

CopperLynx7
That usually means TypeScript isnโ€™t loading the TanStack Start route types. The `server` option is valid in a TanStack Start project, but it wonโ€™t be recognized if the project is being treated as a plain `@tanstack/react-router` app. Check that youโ€™re using the TanStack Start Vite plugin, that all TanStack packages are on compatible versions, and that your `tsconfig` path aliases arenโ€™t resolving types from a different installation. After fixing that, restart the TypeScript server or dev process so the generated route types are picked up.

OrbitMango19: Also check for duplicate or mismatched TanStack packages in the lockfile. An older router type can cause exactly this error even when the application itself is configured for Start.

QuietPebble83: In my case, starting the development server regenerated the route types and the error disappeared. Restarting the editorโ€™s TypeScript server afterward helped too.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions