clerk / javascript

Official Javascript repository for Clerk authentication
https://clerk.com
MIT License
1.12k stars 246 forks source link

Recent upgrade breaks session validation (Remix?) #1519

Closed Ehesp closed 1 year ago

Ehesp commented 1 year ago

Package + Version

Dependencies + versions

Provide a json with the dependencies used in your project (copy paste from yarn.lock / package-lock.json) or a github project / template that reproduces the issue.

*Include the @clerk/ packages and their versions!**

Example:

"@clerk/remix": "^2.9.0",
"@remix-run/cloudflare": "1.17.1",
"@remix-run/cloudflare-pages": "1.17.1",
"@remix-run/react": "1.17.1",
"@remix-run/dev": "1.17.1",

Browser/OS

N/A

Description

I've recently been using Clerk Remix ^2.6.16 for a good while with no issue, and recently upgraded to 2.9.0. I started to notice some strange issues with the authentication flow. Forgive me, but I'm confused as to what's going on.

I validated this issue still happens with the V2_ClerkErrorBoundary too.

  1. Login to my application using the SignUp component. (Note I'm using getAuth() to check they can access the login route.
  2. Successfully login and use my application.
  3. After 60 seconds (when the JWT should refresh), whenever I now navigate to an internal page (which has a getAuth() call), the auth.userId result is now null. I redirect the user back to /login.
  4. The login page, also validates the userId is null, and allows access.
  5. The SignUp component attempts to render, however an error in console says that I cannot render this component when the user is authenticated, and redirects me back to home.

It seems as though there's something happening in a version after 2.6.16 which causes the Frontend components to become out of sync with the session being validated within a loader.

The JWT refresh doesn't seem to be updating my cookie maybe?

I've just set the version exactly to 2.6.16 and things are back to normal.

Ehesp commented 1 year ago

Happy to reproduce this by the way - is there a sandbox environment setup anywhere ready to clone?

dimkl commented 1 year ago

@Ehesp thank you for reporting this. There is no sandbox environment setup. It could be very helpful :

I think that the reproduction steps are described in your previous comment and they seem to be clear:

- Login to my application using the SignUp component. (Note I'm using getAuth() to check they can access the login route.
- Successfully login and use my application.
- After 60 seconds (when the JWT should refresh), whenever I now navigate to an internal page (which has a getAuth() call), the auth.userId result is now null. I redirect the user back to /login.
- The login page, also validates the userId is null, and allows access.
- The SignUp component attempts to render, however an error in console says that I cannot render this component when the user is authenticated, and redirects me back to home.
jescalan commented 1 year ago

👋 - hey just checking in to see if there have been any updates here or if there's a reproduction?

clerk-cookie commented 1 year ago

Hello 👋

We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.

As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.

Thanks for being a part of the Clerk community! 🙏

clerk-cookie commented 1 year ago

Hello again 👋

After 40 days of no activity, we'll close this issue. Keep in mind, I'm just a robot, so if I've closed this issue in error, please reply here and my human colleagues will reopen it.

As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.

Thanks for being a part of the Clerk community! 🙏

clerk-cookie commented 2 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.