Error: Invariant: attempted to hard navigate to the same URL on iPhone #61734
Replies: 58 comments
This comment has been minimized.
This comment has been minimized.
-
Hi, there were changes related to this in the most recent version of Next.js |
Beta Was this translation helpful? Give feedback.
-
Hello, unfortunately updating to version |
Beta Was this translation helpful? Give feedback.
-
The above example is fixed in the latest version, can you confirm those errors are in fact from the release after updating to |
Beta Was this translation helpful? Give feedback.
-
Yes, sentry is still screaming about this error even in v13.0.5-canary.6. |
Beta Was this translation helpful? Give feedback.
-
I'm seeing this as well. Has anyone found a fix? Details:
|
Beta Was this translation helpful? Give feedback.
-
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
Beta Was this translation helpful? Give feedback.
-
This has been an issue for six months now #38171. The other ticket has a reproducible environment. Let's please prioritize getting this fixed |
Beta Was this translation helpful? Give feedback.
-
bumping this issue, getting the same issues in Sentry |
Beta Was this translation helpful? Give feedback.
-
My guess is, that there is a bug in next.js since const disableBrowserBackForwardCache = `
window.addEventListener('pageshow', (event) => {
if (event.persisted) {
location.reload();
}
});
`;
<script dangerouslySetInnerHTML={{ __html: disableBrowserBackForwardCache }} /> We added this |
Beta Was this translation helpful? Give feedback.
-
I checked some canary releases of next.js. The bug was introduced in changelog: v12.1.7-canary.31...v12.1.7-canary.32 |
Beta Was this translation helpful? Give feedback.
-
Same, continuously getting this issue on Sentry. Error:
Device: |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, it didn't work for me either |
Beta Was this translation helpful? Give feedback.
-
Getting a ton of these in prod. It's hard to reproduce though. Not sure what the underlying issue is. I'm unclear on what the visitor experiences when they hit this. Does the next site show the hard failure? If so, 😅, need to get a fix in asap. Thanks for looking into this issue ❤️ |
Beta Was this translation helpful? Give feedback.
-
Getting the same issue, haven't been able to replicate it but getting sentry errors every day about it. I'm on Edit: |
Beta Was this translation helpful? Give feedback.
-
We are getting this error with the Googlebot and Android Browser, on regular pages (not 404). Currently on Nextjs 13.2. Does anyone know a recent fix for this? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
I'm getting this error in development as well. It happens when im using Link to route to the current url |
Beta Was this translation helpful? Give feedback.
-
This might not help but in my case I have a "root" app which uses
I'm seeing this when setting Funnily enough this causes fallback to not work at all, because I've however noticed that My project is quite big but I'll try making a reproduction. Very crude reproduction:
If I visit |
Beta Was this translation helpful? Give feedback.
-
Running into this error too. |
Beta Was this translation helpful? Give feedback.
-
same error for chat example, just change frontend port than it happend !
reflex --version 0.2.4 |
Beta Was this translation helpful? Give feedback.
-
Just started getting this error too |
Beta Was this translation helpful? Give feedback.
-
same here, Im seeing this error not sure what went wrong? |
Beta Was this translation helpful? Give feedback.
-
@getayush96 Can you please explain how your workaround fixed the issue? |
Beta Was this translation helpful? Give feedback.
-
We are also getting this issue. Not very often but constantly. Thinking of ignoring this in sentry since we are able to handle it in client side. Next.js version For us it is happening 95% in iOS and 5% Mac OS X. 50% of mobile safari and 45% of mobile chrome. |
Beta Was this translation helpful? Give feedback.
-
having this issue also, Brave latest v1.58.124, next latest v13.4.19 |
Beta Was this translation helpful? Give feedback.
-
Started gettinng this issue after adding this into my next.config because i need the host as part of my getServerSideProps
|
Beta Was this translation helpful? Give feedback.
-
This happens when I try to add a |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, The latest on this issue seems to be related to a @mattvb91 @jacobgoldfarb Is it possible to create a new bug report so we can look at both of your issues separately? I encourage others as well to create separate bug reports if they are still experiencing this on the latest version. At the moment, it is not feasible to maintain multiple edge cases (old or newly introduced) in a single large issue thread (creates a lot of noise), so I will be moving this conversation to |
Beta Was this translation helpful? Give feedback.
-
I faced the same error, for the pages which had getServerSideProps. |
Beta Was this translation helpful? Give feedback.
-
I deleted |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 18.12.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 13.0.3
eslint-config-next: 13.0.3
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Google Chrome v107.0.5304.107
How are you deploying your application? (if relevant)
next start, Digital Ocean
Describe the Bug
Hi, I just connected my production next.js app to the error tracker and noticed a lot of errors, which all give:
Error: Invariant: attempted to hard navigate to the same URL https://[domain-name]/[locale]
.The error occurs only on localized versions of website and only on iPhone mainly safari v14, 15, 16 but also on Edge Mobile Version:107.0.1418 and Chrome Mobile iOS Version:107.0.5304.
Source of all errors:
{snip} dLocale.addLocale(router.asPath,router.locale)))throw Error("Invariant: attempted to hard navigate to the same URL ".concat(url," ").concat( {snip}
Example log:
It seems that after navigation to the same localized url it can't find the [locale].json file. This website does not implement getServerSideProps or getStaticProps.
I've tested all link components both on production, development, emulated safari browser but I haven't noticed any errors/warnings in the console and I don't know what can cause this behavior for iPhone visitors.
I was using Next.js v12.2.4 but the error still occurs after upgrading to v13. I am also using next-translate v1.6.0 in my project and I don't know if the error can be related to this package or to next.js itself.
Thanks
next.config.js
i18n.json
Expected Behavior
Normal navigation to the same localized route on iPhone device.
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
Not relevant
To Reproduce
Not relevant
NEXT-1367
Beta Was this translation helpful? Give feedback.
All reactions