abldxtr001
abldxtr0012mo ago

Convex Helpers error

I am getting this error while using Convex helper with Next.js 15.
4 Replies
erquhart
erquhart2mo ago
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.
abldxtr001
abldxtr001OP2mo ago
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>
erquhart
erquhart2mo ago
Ah, a note in the query cache provider docs:
import { ConvexQueryCacheProvider } from "convex-helpers/react/cache";
// For Next.js, import from "convex-helpers/react/cache/provider"; instead
import { ConvexQueryCacheProvider } from "convex-helpers/react/cache";
// For Next.js, import from "convex-helpers/react/cache/provider"; instead
Try that
abldxtr001
abldxtr001OP2mo ago
Thank you, it worked!

Did you find this page helpful?