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?2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Looks like Clerk issue, I'd check their resources. Here's a relevant thread from their discord: https://discord.com/channels/856971667393609759/1371560454387798036