-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Invariant: attempted to hard navigate to the same URL #44919
Comments
Have you tried
|
Thank you for your reply Yes I have tried to return NextResponse and still not work Infact I tried empty middleare which only returns response.next |
Duplicate of #44293 |
I have run to the same issue and created a Repository for describing and demonstrating the problem: https://github.com/raimohanska/nextjs-custom-error-page |
I have the same issue, Any update? |
Same issue is happening here as well. When I either remove my middleware completly or replace my custom 404 page (404.js) by the generic _error.js page, the error doesn't happen anymore. This is happenning on a production build as well. Is there any workaround in the meantime to bypass this? |
My work around was sily but its not the optimal solution for web crawlers since it doesnt return 404 status Which is having catch all route [...404].tsx That returnd 404 component |
Chiming in here as I am also seeing an issue with middleware in combination with a custom 404 page. I downgraded to 13.0.6 (previously was on 13.1.6) as per #44293 (comment) |
Issue seems to be resolved from this release. We've upgraded our app to 13.2.0 and now our custom 404 page works fine with the middleware 👍 |
for me it was due to server returning 404 on |
how solve it? |
Verify canary release
Provide environment information
node > 14
NextJS 13.1.1
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/floral-glitter-3mp1x0?file=%2Fnext.config.js&selection=%5B%7B%22endColumn%22%3A1%2C%22endLineNumber%22%3A11%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A11%7D%5D
CodeSandbox example here
just try to visit any 404 URL like /en/reset-password
and invariant will trigger
Describe the Bug
Am trying to use a middleware to redirect users using localization middleware
Everything works fine until I implement a 404.tsx page
which results in showing
for the 404 pages ( only when using 404.tsx )
Expected Behavior
To show 404 without any error similar
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: