Eliot Gevers
Eliot Gevers7d ago

Convex + Expo + Clerk (monorepo) - cannot read property 'useContext'

I am setting up Convex + Expo + Clerk (monorepo), and I am running into the following issue:
ERROR [TypeError: Cannot read property 'useContext' of null]

Code: ConvexClientProvider.tsx
16 | return (
17 | <ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
> 18 | <ConvexProviderWithClerk client={convex} useAuth={useAuth}>
| ^
19 | {children}
20 | </ConvexProviderWithClerk>
21 | </ClerkProvider>
Call Stack
ConvexClientProvider (apps/mobile/app/ConvexClientProvider.tsx:18:7)
RootLayout (apps/mobile/app/_layout.tsx:56:5)
ERROR [TypeError: Cannot read property 'useContext' of null]

Code: ConvexClientProvider.tsx
16 | return (
17 | <ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
> 18 | <ConvexProviderWithClerk client={convex} useAuth={useAuth}>
| ^
19 | {children}
20 | </ConvexProviderWithClerk>
21 | </ClerkProvider>
Call Stack
ConvexClientProvider (apps/mobile/app/ConvexClientProvider.tsx:18:7)
RootLayout (apps/mobile/app/_layout.tsx:56:5)
I am following the official docs: by Convex and by Clerk. Both give this error.
Convex & Clerk | Convex Developer Hub
Integrate Clerk authentication with Convex
1 Reply
Convex Bot
Convex Bot7d ago
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!

Did you find this page helpful?