#server side authentication not working with nextjs after upgrade

2 messages · Page 1 of 1 (latest)

untold gust
#

I'm using convex in my nextjs app for authentication. I have recently upgraded to latest [email protected], latest [email protected] and latest @clerk/[email protected]. 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?

mossy talonBOT
#

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](https://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!