Skip to content
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

Invariant: attempted to hard navigate to the same URL #44919

Open
1 task done
mohux opened this issue Jan 16, 2023 · 0 comments
Open
1 task done

Invariant: attempted to hard navigate to the same URL #44919

mohux opened this issue Jan 16, 2023 · 0 comments
Labels
template: bug A user has filled out the bug report template. Issue needs triaging

Comments

@mohux
Copy link

mohux commented Jan 16, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js 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

Invariant: attempted to hard navigate to the same URL

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

@mohux mohux added the template: bug A user has filled out the bug report template. Issue needs triaging label Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: bug A user has filled out the bug report template. Issue needs triaging
Projects
None yet
Development

No branches or pull requests

1 participant