noob saibot
noob saibot3mo ago

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;
}
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?
2 Replies
Convex Bot
Convex Bot3mo 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!
erquhart
erquhart2mo ago
That function doesn't have any convex code, it's between clerk and next. I'd ask about it in the Clerk discord.

Did you find this page helpful?