lil_nach
lil_nach6mo ago

Infinite api calls to clerk

Has anyone noticed this with the <ConvexProviderWithClerk> component where there are an endless number of calls being made to the clerk issuer domain? Noticed this in my own project and confirmed it still occurs in this template locally as well https://github.com/get-convex/templates/tree/main/template-nextjs-clerk-shadcn.
No description
4 Replies
ballingt
ballingt6mo ago
What's the timing on these? Clerk JWTs expire in 1 minute (I think? or is it 5 minutes?) by default, so it's necessary to refresh them just a bit faster than that. We suggest people use the Convex template which lengthens this to one hour https://clerk.com/docs/integrations/databases/convex#create-a-jwt-template-based-on-convex But if you see updates faster than once a minute, then that sounds like a problem.
lil_nach
lil_nachOP6mo ago
hmm weird. I tried deleting and re-creating the convex JWT template with default settings and that seemed to work. I wonder if it was because I had messed with the token lifetime For reference, the calls were being made at an insane pace, like 10 each second
ballingt
ballingt6mo ago
oh ok, yeah that's not good once every 45 seconds or so would be reasonable, if it's going to expire in 60 seconds we want to refresh a few seconds before expiration so there's a chance for some retries
ian
ian6mo ago
I've seen odd behavior when Clerk tokens are invalid / not matching the project I'm using. I wonder if re-creating the template cleared some cache for you. In general I've found clearing localStorage / sessionStorage / cookies to clear up some issues w.r.t. clerk

Did you find this page helpful?