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

0
0
Asked By MellowCedar47 On

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?

1 Answer

Answered By OrbitLark8 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.