I'm using Next.js 15 (canary version), and everything works fine most of the time. However, occasionally after a hard reload, the middleware indicates the user is authenticated, but mutations fail because the ctx.user is undefined. For example, inside a mutation:
...
const userId = await getAuthUserId(ctx)
...
returns undefined, This issue seems to resolve itself after a few refreshes.
What could be causing this behavior?
I'm using:
"@auth/core": "^0.37.4",
"@convex-dev/auth": "^0.0.75",
"convex": "^1.17.3",
"convex-helpers": "^0.1.65",