Lyonel PierceL
Convex Community6mo ago
2 replies
Lyonel Pierce

Clerk, convex, tanstack-start error

TypeError: Cannot read properties of undefined (reading 'config')

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?
Was this page helpful?