noob saibotN
Convex Community7mo ago
2 replies
noob saibot

server side authentication not working with nextjs after upgrade

I'm using convex in my nextjs app for authentication. I have recently upgraded to latest nextjs@15.3.3, latest convex@1.24.8 and latest @clerk/nextjs@6.22.0. To make authenticated requests to Convex during server rendering, I retrieve to token using the below code from the documentation (see https://docs.convex.dev/client/react/nextjs/server-rendering):
export async function getAuthToken() {
  return (await (await auth()).getToken({ template: "convex" })) ?? undefined;
}

But I'm observing that this code systematically returns undefined even after I have successfully authenticated. This behavious is only observed in production, not in dev mode. This code used to work. It broke after above upgrade. The latest @clerk/nextjs` has introduced some breaking changes. Could these changes, perhaps, have broken the integration between clerk-next-convex?
Was this page helpful?