New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign out not working reliably in @clerk/nextjs v5 #3353
Comments
For additional context, the issue behaves slightly differently in the code for our app vs the repro. For starters in our code it occurs 100% of the time vs ~50% in the repro. Essentially, as soon as you hit sign out the client-side error occurs. It does not redirect to sign in or any other url provided to the sign out function callback. Using the signOut function vs SignOutButton etc. doesn't make a difference. When digging into middleware, what appears to be happening is that auth.protect() still seems to think the user is authenticated and does not redirect to sign in or, auth() still seems to be populated with the user's info / etc. But when getToken is called somewhere within the route it fails and causes the error (but that code should not be reachabale by a signed out user on a route that's "protected") This did not occur in the previous 4.x version with authMiddleware that we were using before. |
Hello @philefstat , we've pushed a fix with our latest release! You don't have to upgrade your packages as long as running I'm closing this one, but please feel free to reopen if needed! |
Preliminary Checks
Reproduction
https://github.com/philefstat/clerk-bug-repro
Publishable key
pk_test_c3BsZW5kaWQtY2hpZ2dlci00NS5jbGVyay5hY2NvdW50cy5kZXYk
Description
The repro above is simply the clerk nextjs started with the @clerk/nextjs version bumped to 5.0.7 and no other modifications.
Steps to reproduce:
Expected behavior:
User is signed out and redirected to login
Actual behavior:
Full page client-side error about 50% of the time
Environment
The text was updated successfully, but these errors were encountered: