Convex Helpers error
I am getting this error while using Convex helper with Next.js 15.
4 Replies
Looks like you’re trying to use the query cache provider in a server component, it has to be used in a client component. The message is telling you that createContext, which is used by the provider, can only run in a client component, so you’ll need to add “use client” at the top of whatever file you’re using it in.
I am using the same approach as described in the documentation.
<ConvexAuthNextjsServerProvider>
<html lang="en" suppressHydrationWarning>
<body className="">
<ConvexClientProvider>
<GlobalProvider>
<ConvexQueryCacheProvider>
{children}
</ConvexQueryCacheProvider>
</GlobalProvider>
</ConvexClientProvider>
</body>
</html>
</ConvexAuthNextjsServerProvider>
Ah, a note in the query cache provider docs:
Try that
Thank you, it worked!