Infinite _rsc= query param requests when using withAuth
middleware with Next.js 13 app dir
#7850
Replies: 2 comments
-
UPDATE: this looks to be an issue with Turbopack as when I use webpack, no issue arises. Leaving here for others to see. |
Beta Was this translation helpful? Give feedback.
-
I'm having this same problem and I have not been able to solve it. In my case whatever is in the callbackUrl is getting hit with a ?_rsc= request resulting in infinite recursive redirects. Everything works fine so long as I navigate directly to the login page, but if I go to a different page without being authenticated and I get redirected to the login page with a callbackUrl set in the query string, then all heck breaks loose. I hadn't realized it was happening, you only can tell if you look at the network tab, but when I recently implemented middleware logging I discovered this monstrosity. What's worse is it's stripping the _rsc portion off of the request so I can't even detect it or match it! It really seems like a bug that nobody has noticed because it's invisible unless you are looking closely. It shouldn't be prefetching pages if it's not authenticated yet! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have the following middleware.ts file:
and it result in infinite fetch requests to http://localhost:3000/my/path?_rsc=2d11594. Does anyone have any idea why this is happening? I've seen a couple of other issues related to infinite redirects, but this has to do with infinite fetches. I thought it had to do with prefetching, but there are no
Link
s on my page. Note, this doesn't happen on my /login page which is excluded from middleware.Beta Was this translation helpful? Give feedback.
All reactions