When Clerk token expires, errors thrown on client

I have a basic middleware component that checks for a users status, and throws an error if the identity for the user isn't found modeled off the Authentication docs. When a token expires on the frontend this throws an error when a query is made. Which is triggering my error boundary, is there potentially a way to redirect the user or catch this before the query is made or a recommended best approach for handling this? I'm thinking maybe check the user isLoggedIn status for clerk at the top of my app.
2 Replies
Michal Srb
Michal Srb2y ago
Hey @Chad Maycumber , if you're on the latest version of Convex the auth token should never expire, ConvexProviderWithClerk will refetch it preemptively. Which version are you on? What hook are you using in your middleware?
Chad Maycumber
Chad MaycumberOP2y ago
Let me take a look at my sentry and debug this a little more. I really notice it with the Clerk impersonation feature, I assume because the token is only valid for a limited amount of time

Did you find this page helpful?