Clerk, convex, tanstack-start error
I am getting this error on my __root.tsx file
It looks like the error occurs on beforeLoad function when calling fetchClerkAuth()
beforeLoad: async (ctx) => {
const auth = await fetchClerkAuth()
const { userId, token } = auth
if (token) {
ctx.context.convexQueryClient.serverHttpClient?.setAuth(token)
}
return {
userId,
token,
}
},const fetchClerkAuth = createServerFn({ method: 'GET' }).handler(async () => {
const auth = await getAuth(getWebRequest())
const token = await auth.getToken({ template: 'convex' })
return {
userId: auth.userId,
token,
}
})Any idea how to fix it?
