-
Notifications
You must be signed in to change notification settings - Fork 405
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
Improve App Router DX/documentation #1614
Comments
How can I find out which RSC is trying to set cookies? In my code, I can't find any RSC that imports auth0 and retrieves session. It's always a client component. So IDK how or why this warning shows. It doesn't have any information about the exact location of the RSC.
So right now I get this warning even if I'm not doing anything wrong? |
I'm getting this warning just by adding Not sure why the warning applies in this case |
I found a comment in the source code for the nextjs-auth0/src/client/use-user.tsx Lines 97 to 115 in 951a248
|
@mscottford Any chance of looking at the source code of |
I'm also confused by this. When are you emitting these warnings? I added getSession to every call in middleware per @adamjmcgrath 's advice and I'm still getting it: |
Also, my recent PR applies to this issue #1750 |
Checklist
Describe the problem you'd like to have solved
Using nextjs-auth0 with the App Router results in a bunch of noisy warnings:
The advice given isn't particularly clear, but the only issue by default seems to be the first one:
However, enabling
withMiddlewareAuthRequired
isn't an option for this project; logging in is optional. And even when using it, the warning is still printed constantly!Digging through the source, I found that this middleware might do something similar while keeping auth optional, but the
touchSession
function isn't even officially documented!A fresh project immediately after following the official setup guide should not be printing unavoidable warnings.
Describe the ideal solution
Only show the warning if there's an actual problem, that is, if userland code tries to set a cookie, or if there is no middleware configured to touch the session.
Document
touchSession
as an alternative towithMiddlewareAuthRequired
.Alternatives and current workarounds
I suppose you could configure
autoSave: false
ininitAuth0
- I'm not sure if this would help. Maybe it should be set by default? At the very least, it should be documented if it helps!Additional context
No response
The text was updated successfully, but these errors were encountered: