#Clerk, convex, tanstack-start error

1 messages · Page 1 of 1 (latest)

patent meadow
#

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?

dark anchorBOT
#

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](https://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!