question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Production mode pushRoute issue

See original GitHub issue

I am really stumped. When certain conditions exist, Router.pushRoute runs without doing anything, without any console errors appearing.

All of these are conditions must be met to see the issue:

  • Running a Next.js build in production mode. Dev mod is fine in all browsers.
  • Cache must be cleared. If you have visited the page you are trying to route to, it will work.
  • Firefox or Safari. Chrome is fine.
  • For Safari, an additional condition is required: It must be a deployed live site (I’m using Now), all the above conditions work locally.

I am using pushRoute via fridays/next-routes inside an Apollo mutation callback. I have console logged everything ok up until the Next.js router is meant to do it’s thing here. I am pretty confused how to debug from there.

If you manually click a link to the same route in the site nav because you are sick of waiting, it transitions fine.

Seen in 3.0.0-beta10 and 3.0.0-beta11.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
graglandcommented, Jun 12, 2017

@jaydenseric I’ve been having a similar issue which I believe is caused by the same bug. In production if I click a link (created with <Link prefetch>) right after the page loads RouteChangeStart will fire and then nothing happens. The next time I click a link onRouteChangeError fires, just like you describe. Because this is intermittent my guess is that it’s only happening if the prefetch has not yet completed before the link is clicked.

1reaction
jaydensericcommented, Jun 12, 2017

Further clues.

Ruled out it having anything to do with query batching.

Interestingly, when replacing:

Router.pushRoute('user', { userId })

With:

window.location.href = `/users/${userId}`

It works. Something silently breaks within the imperative Router API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Production mode pushRoute issue · Issue #2195 · vercel/next.js
I am really stumped. When certain conditions exist, Router.pushRoute runs without doing anything, without any console errors appearing.
Read more >
Parameter routing and condition dont work on production mode
The problem starts when I publish on production, the URL I tried is: myapp.company.com/scenario/?utm_source=kiosk it just return 404 - file ...
Read more >
next/router | Next.js
This is a production only feature. Next.js doesn't prefetch pages in development. router.prefetch(url, as ...
Read more >
Reference Manual For OpenVPN 2.4
OpenVPN 2.0 introduces a new mode ("server") which implements a multi-client server ... This article outlines some of problems with tunneling IP over...
Read more >
[Solved]-How to push to netlify in production mode [Nuxt JS]-Vue.js
As it looks you need to tweak your deployment command. Go to Netlify and try changing it to npm install; npm run build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found