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

router.push fails when app is ran over file:// not http:// #17212

Closed
momakes3 opened this issue Sep 18, 2020 · 2 comments
Closed

router.push fails when app is ran over file:// not http:// #17212

momakes3 opened this issue Sep 18, 2020 · 2 comments

Comments

@momakes3
Copy link

momakes3 commented Sep 18, 2020

Bug report

Describe the bug

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Run https://github.com/vercel/next.js/tree/canary/examples/with-electron (or an exported Next.js (eg. out/index.html) over file:// I do this via an electron-next app)
  2. Click on a button that triggers router.push('/about')
  3. It will not navigate but throw an error: 'Invalid relative URL`

Expected behavior

Should accept the URL even if it's not served over HTTP, but it's file://.

Screenshots

When run the static export, any router.push call results in this error now:
ElectronNext 2020-09-19 at 12 02 30@2x

System information

  • OS: macOS
  • Browser (if applies) Electron/Chrome
  • Version of Next.js: 9.5.3
  • Version of Node.js: 12.8

Additional context

Change of this line I believe is causing Next's router to fail when Next static output is ran in file:// context rather than served on an HTTP server:
https://github.com/vercel/next.js/blob/canary/packages/next/next-server/lib/router/utils/parse-relative-url.ts#L26

We use Next in Electron and it was working perfectly using the next's static export.

@momakes3 momakes3 changed the title router.push fails when app ran in file:// context router.push fails when app is ran over file:// not http:// Sep 18, 2020
prusnak pushed a commit to trezor/trezor-suite that referenced this issue Oct 3, 2020
This change fixes the upstream issue vercel/next.js#17212
Let's remove the patch once the upstream fixes this in their release
@jankaifer
Copy link
Contributor

This seems to be fixed:
#17216 (comment)

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants