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

Error: Route did not complete loading: /projects #21543

Closed
dawksh opened this issue Jan 26, 2021 · 16 comments · Fixed by #22775
Closed

Error: Route did not complete loading: /projects #21543

dawksh opened this issue Jan 26, 2021 · 16 comments · Fixed by #22775
Assignees
Milestone

Comments

@dawksh
Copy link

dawksh commented Jan 26, 2021

What version of Next.js are you using?

10.0.5

What version of Node.js are you using?

14.15.0

What browser are you using?

Chrome

What operating system are you using?

Windows 10

How are you deploying your application?

Vercel

Describe the Bug

I am trying to build a simple route for my portfolio. The route is '/projects'. I've added a projects.js file in the pages directory with the logical code and when I use next/link for client side transition, I get an error: Route did not complete loading: "projects".
When I use regular anchor tag for routing, there is no issue.

Expected Behavior

It should change the route to the destined page without any error.

To Reproduce

import styles from '../styles/Home.module.css'
import Link from 'next/link'

export default function Footer() {
    return (
        <>
            <div className={styles.link}>
                <a href="https://github.com/devdaksh" target="__blank">github</a>
                <a href="https://twitter.com/dawksh" target="__blank">twitter</a>
                <a href="https://devdaksh.hashnode.dev" target="__blank">blogs</a>
                <a href="mailto:[email protected]">email</a>
                <Link href="/projects" >
                    <a>projects</a>
                </Link>
            </div>
        </>
    )
}

Screenshot (130)

This is a screenshot of the error

@dawksh dawksh added the bug Issue was opened via the bug report template. label Jan 26, 2021
@donpark
Copy link

donpark commented Jan 28, 2021

Seeing the same on macOS with:

  • development build
  • production build
  • on page with <Link> tag
  • on page routed to via <Link> tag.

Same 10.0.5 version of Next.js running on Node 14.15.4.

I also tested previous minor versions and found that 10.0.1 is the last version that does not throw this error. 10.0.0 is fine also.

@mikkelramlov
Copy link

Same error here. +1

@retr00exe
Copy link

I'm facing the same error too on my project. The official next.js website also has this issue if you open chrome developer tools and click one of its routes a couple of times.

@Timer Timer added kind: bug and removed bug Issue was opened via the bug report template. labels Jan 29, 2021
@Timer Timer added this to the iteration 16 milestone Jan 29, 2021
@GaddMaster
Copy link

I am also getting this error. I am not far off the official tutorials. I am pretty sure I was getting it while following the site basic tutorial.

@bpas247
Copy link

bpas247 commented Feb 4, 2021

This error seems to be originated from here, which was added in #19006 (and was released in v10.0.2).

I'm not entirely sure if this code itself is what's causing the error to be thrown, I would assume not since we would have noticed it earlier on, so something else seems to be causing the idleTimeout promise to be resolved earlier than the onBuildManifest promise is being resolved.

In other words, something is causing onBuildManifest to take way longer than expected.

@dbo
Copy link
Contributor

dbo commented Feb 10, 2021

IMO this is not a real issue, but rather annoying if you've enabled Pause on exceptions in devtools. The Promise.race correctly resolves the route loading, the timeout promise is just dangling after and devtools stops on it.

@GaddMaster
Copy link

Yep, pause on exception triggers it

@donpark
Copy link

donpark commented Feb 10, 2021

Chrome has a similar 'ghost' exception bug with FileSystemWritableFileStream when close (sometimes write) is called that also goes away when "Pause on exceptions" is disabled.

I'd treat this as a real bug because:

  1. It's not a corner case.
  2. It's a fixable bug AFAIK.
  3. Developers among users of apps built using Next.js may see it and report it as a bug which multiplies unnecessary waste of resources.

My advice is to make idletTimeout cancellable and have the good path cancel timeout when it finishes first. It's a common enough pattern and cancellable Promise is not expected to arrive for a while so I think it's worth investing some time on.

@dbo
Copy link
Contributor

dbo commented Feb 10, 2021

I agree, you could look at it as a dev issue, even though it does not have impact on production sites, and I totally agree about (3), unnecessary issue noise.

@timkindberg
Copy link

We are experiencing this issue in our automated tests, it's failing our suite. I was able to reproduce this error without having "pause on exception" turned on.

@dawksh

This comment has been minimized.

@florianmartens

This comment has been minimized.

@shuding shuding self-assigned this Mar 4, 2021
@kodiakhq kodiakhq bot closed this as completed in #22775 Mar 5, 2021
kodiakhq bot pushed a commit that referenced this issue Mar 5, 2021
In the current implementation, `idleTimeout` will always be thrown even if it didn't time out and `Promise.race` was resolved. This causes the error `Error: Route did not complete loading` on every route transition and Chrome Devtools will pause code execution if you have "Pause on exceptions" enabled.

This PR adds `resolvePromiseWithTimeout` which does the same thing as `Promise.race` and `idleTimeout`, but it cancels the rejection when it resolves successfully, in which case the error won't be thrown.

Fixes #21543.
@ocodista
Copy link

ocodista commented May 6, 2021

I'm also seeing this error on [email protected]

@ghost
Copy link

ghost commented May 20, 2021

The exception is annoying and wastes developer's time. It would be lovely to have it fixed, rather than having to ignore it. Here is [email protected]

@timneutkens
Copy link
Member

Please open a new issue with a complete reproduction and we'll have a look!

@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 28, 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.