Typescript error with server functions with the GET method
I migrated successfully my app to RC, I have only one issue with server functions using the get method, like this one
now I have this error:
the types of 'options.query.unwrap' are incompatible between these types.
Type '(() => ZodObject<{ disableCookieCache: ZodOptional<ZodCoercedBoolean<unknown>>; disableRefresh: ZodOptional<ZodCoercedBoolean<unknown>>; }, $strip>) & (() => ZodObject<...>)' is not assignable to type '"Function is not serializable"'
4 Replies
unwilling-turquoise•2w ago
It sounds like theres a function somewhere in userSession, but I can't see the connection between your code block and the zod errors
Or what your auth provider is
If you can put this in a codesandbox or stackblitz that would be helpful
(If you have a function in an object the object cant be serialised to Json)
optimistic-gold•2w ago
dont use
getRequest
, use getRequestHeaders
directly, as in
`stormy-gold•2w ago
Sounds like you are using Zod v4 with their
z.coerce.boolean()
schema. Try specifying the type so it is not inferred as unknown
:
z.coerce.boolean<boolean>()
adverse-sapphireOP•2w ago
this is a demo app showcasing how to integrate better-auth with tanstack start, I tried to use the best practices and the latest versions of every package included
https://github.com/aliallaoua/better-auth/
GitHub
GitHub - aliallaoua/better-auth
Contribute to aliallaoua/better-auth development by creating an account on GitHub.