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

Spurious "Invalid href passed to router" with Next 9.1.5 #9782

Closed
jjs-stripe opened this issue Dec 18, 2019 · 9 comments
Closed

Spurious "Invalid href passed to router" with Next 9.1.5 #9782

jjs-stripe opened this issue Dec 18, 2019 · 9 comments
Labels
please add a complete reproduction The issue lacks information for further investigation

Comments

@jjs-stripe
Copy link

Bug report

Describe the bug

When attempting to upgrade to Next 9.1.5, our app crashes as soon as we attempt to use the router.
router.replace('/testing/foo') results in an error saying "invalid href passed to router".

To Reproduce

Unfortunately this happens in our private repo.

Expected behavior

Router redirects to the correct destination

Screenshots

System information

  • Version of Next.js: 9.1.5

Additional context

This may be an issue with trailing dependencies as we have not been able to upgrade all the dependencies that Next 9.1.5 uses.

@timneutkens timneutkens added the please add a complete reproduction The issue lacks information for further investigation label Dec 18, 2019
@timneutkens
Copy link
Member

Unfortunately it's close to impossible to help without a reproduction.

@olpeh
Copy link

olpeh commented Dec 19, 2019

Hi, in our case this resulted as all the links becoming unclickable on IOS10 and iOS11 devices due to the above mentioned error "invalid href passed to router". We did not notice it immediately, but got it reported from our users.

I think this should be possible to reproduce.

Downgrading helped us, now waiting for this bug to get fixed before considering upgrading.

@timneutkens
Copy link
Member

I think this should be possible to reproduce.

So that means you can provide a reproduction? As there is no reproduction provided.

@olpeh
Copy link

olpeh commented Dec 19, 2019

So that means you can provide a reproduction? As there is no reproduction provided.

Oh, my bad. Here are steps for reproduction:

  1. Install next.js v.9.1.5
  2. Run your project
  3. Open the site with an iOS10 or iOS11 device, Safari (emulator should "work" as well)
  4. Try to click a link that uses Next.js component and should do a SPA navigation
  5. Nothing happens, error: "invalid href passed to router"

@ccambournac
Copy link

@olpeh I am indeed experiencing the same issue with Next.js 9.1.5+ and not with 9.1.4.
Do you use next-i18next?

@timneutkens I will try to provide a reproduction repo as soon as possible.

@ccambournac
Copy link

ccambournac commented Dec 22, 2019

Hi @timneutkens

Here is a reproduction repository: https://github.com/ccambournac/aria

For confidentiality purposes, it is made private. It is a big project, however, so please don't focus on anything else than the present issue :)

To reproduce:

  • Install project from root with sh scripts/install.sh;
  • Go to project directory and start with yarn build:assets && yarn start; (Issue reproduced with production build as well.)
  • Open homepage at http://localhost:8000/en in iOS 11.2 or lower and see errors like [Error] Unhandled Promise Rejection: Error: Invalid href passed to router: http://localhost:8000/signin?lng=fr&subpath=fr coming from navigation menu. Indeed no links are working. (Issue can be reproduced with Xcode Simulator app.)

Disabling next-i18next and using Next.js' Link and Router components instead does not solve the issue.

When using Next.js 9.1.4, errors do not occur any more.

Thank you very much for your help.

@code2k
Copy link

code2k commented Dec 27, 2019

I had to downgrade two of my sites to next.js 9.1.4 after discovering that links are not working anymore with some older browsers.

To reproduce:

yarn create next-app --example using-router using-router-app

Using iOS Safari 10, no link is working.

@timneutkens
Copy link
Member

Same as #9851

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
please add a complete reproduction The issue lacks information for further investigation
Projects
None yet
Development

No branches or pull requests

6 participants