Description
After upgrading from convex@1.32.0 to convex@1.34.0, ConvexProviderWithClerk sends raw Clerk session tokens instead of tokens generated via the "convex" JWT template. This causes ctx.auth.getUserIdentity() on the server to return an identity missing all custom template claims (e.g. role, name, email).
Root cause
In v1.34.0, ConvexProviderWithClerk added a conditional that skips the JWT template when sessionClaims?.aud === "convex":
// v1.34.0 — broken
if (sessionClaims?.aud === "convex") {
return await getToken({ skipCache: forceRefreshToken }); // no template!
} else {
return await getToken({ template: "convex", skipCache: forceRefreshToken });
}
When aud === "convex", it calls getToken() without template: "convex", returning the raw session token which lacks custom JWT template claims.
In v1.32.0, it always requested the template:
// v1.32.0 — correct
return await getToken({
template: "convex",
skipCache: forceRefreshToken
});
Reproduction
Setup:
ConvexProviderWithClerk with useAuth from @clerk/clerk-react
- Clerk JWT template named
"convex" configured with custom claims including role
With convex@1.32.0 — getUserIdentity() returns the full template token:
{
"tokenIdentifier": "...",
"name": "...",
"email": "...",
}
With convex@1.34.0 — getUserIdentity() returns a raw session token:
{
"tokenIdentifier": "...",
"fva": [74, -1],
"sid": "sess_...",
"sts": "active",
"v": 2
}
Same Clerk project, same Convex deployment, same JWT template — only the convex package version changed.
Impact
Any server-side code that reads custom claims from the identity (e.g. role-based access control via identity.role) breaks silently, since those fields are missing from the raw session token.
Workaround
Pin convex to 1.32.0 in package.json.
Environment
convex: 1.34.0 (broken), 1.32.0 (working)
@clerk/clerk-react: ^5.x
convex/react-clerk: ConvexProviderWithClerk
Description
After upgrading from
convex@1.32.0toconvex@1.34.0,ConvexProviderWithClerksends raw Clerk session tokens instead of tokens generated via the"convex"JWT template. This causesctx.auth.getUserIdentity()on the server to return an identity missing all custom template claims (e.g.role,name,email).Root cause
In
v1.34.0,ConvexProviderWithClerkadded a conditional that skips the JWT template whensessionClaims?.aud === "convex":When
aud === "convex", it callsgetToken()withouttemplate: "convex", returning the raw session token which lacks custom JWT template claims.In
v1.32.0, it always requested the template:Reproduction
Setup:
ConvexProviderWithClerkwithuseAuthfrom@clerk/clerk-react"convex"configured with custom claims includingroleWith
convex@1.32.0—getUserIdentity()returns the full template token:{ "tokenIdentifier": "...", "name": "...", "email": "...", }With
convex@1.34.0—getUserIdentity()returns a raw session token:{ "tokenIdentifier": "...", "fva": [74, -1], "sid": "sess_...", "sts": "active", "v": 2 }Same Clerk project, same Convex deployment, same JWT template — only the
convexpackage version changed.Impact
Any server-side code that reads custom claims from the identity (e.g. role-based access control via
identity.role) breaks silently, since those fields are missing from the raw session token.Workaround
Pin
convexto1.32.0inpackage.json.Environment
convex: 1.34.0 (broken), 1.32.0 (working)@clerk/clerk-react: ^5.xconvex/react-clerk:ConvexProviderWithClerk