kstulgysK
Convex Community2y ago
12 replies
kstulgys

I use convex auth with nextjs setup, but userId always null

export const authQuery = customQuery(
  query,
  customCtx(async (ctx) => {
    const userId = await auth.getUserId(ctx);
    if (!userId) throw new Error("Authentication required");
    const user = (await ctx.db.get(userId))!;
    return { userId, user };
  })
);
Was this page helpful?