mrblahblahmeowM
Convex Communityβ€’2y agoβ€’
5 replies
mrblahblahmeow

clerk integration next.js

Hey all, new developer here!

I am trying to use Clerk Auth with Convex and I seem to keep getting this error:

Unhandled Runtime Error
Error: Could not find Convex client! useMutation must be used in the React component tree under ConvexProvider. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app

I am using next.js and have created the convexclientprovider.tsx file to host both convex and clerk within a single component. However, when I wrap my app in the layout.tsx file with the component it seems to break.

Which ever component is the parent seems to work, while the child doesnt seem to get recognized.

Here is the code for the both files in the attached images.

Any obvious thing I am missing? Thank you!
Screenshot_2024-03-05_at_9.46.02_AM.png
Screenshot_2024-03-05_at_9.46.23_AM.png
Convex is a novel, fun, and extremely productive way to make backends for your
Welcome to Convex | Convex Developer Hub
Was this page helpful?