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.

`Error: Route could not be found for ...` even though `_fallback.svelte` is present.

See original GitHub issue

bug description I’ve just updated from 2.7.3 to 2.9.0 and now I’m getting this;

    Uncaught (in promise) Error: Route could not be found for "parent/12345/children/".
    at urlToRoute (urlToRoute.js:24)
    at runHooksBeforeUrlChange (navigator.js:109)
    at History.history.<computed> [as pushState] (navigator.js:52)
    at goto (helpers.js:313)
    at HTMLDivElement.click_handler (Item.svelte:39)

This where a _fallback.svelte should be loading, and in 2.7.3 it is.

My folder structure is pages/parent/[id]/_fallback.svelte The URL giving the error is /parent/12345/children/1234/children

I would expect for it to load _fallback.svelte and then store the rest of the path in $leftover.

The earliest version that I experience this problem is the jump from 2.7.3 to 2.8.0: https://github.com/roxiness/routify/compare/v2.7.6...v2.8.0

I downgraded back to 2.7.3 and it works as normal. I’ve checked the changelog and can’t see anything that looks like it’s related, so I assume this is not a deliberate change.

It seems there are some changes to runtime/helps.js::resolvePath in 2.8.0, so I suspect it has something to do with that.

version Latest correctly working version: 2.7.3 Earliest broken version: 2.8.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jakobrosenbergcommented, Jan 19, 2021

Thanks @jamalmoir

I assume this is the culprit https://github.com/roxiness/routify/commit/3a695160e70ee2731c751b6349bed5c9130ac3f9

Since 2.8.0 Routify’s beforeUrlChange provides info on the incoming route, which in your case breaks as you navigate to a non-existing route.

So the question is, should _fallback.svelte be considered a route or should beforeUrlChange return null for non-resolved URLs.

0reactions
jakobrosenbergcommented, Feb 11, 2021

Great, @reddec.

@jamalmoir does this patch fix the issue for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a 404 errorcode fallback page for svelte-routing?
svelte -routing is a component-based router and as such it has no control over your server, so it can't manipulate the response in...
Read more >
True SPA mode · Issue #754 · sveltejs/kit - GitHub
Not exactly related to the current discussion, but I'm having an issue when trying to build a static SPA (migrating from a "pure"...
Read more >
Errors • Docs • SvelteKit
The exception is when the error occurs inside the root +layout.js or +layout.server.js , since the root layout would ordinarily contain the +error.svelte...
Read more >
Serving Pages - Cloudflare Docs
​​ Route matching. If an HTML file is found with a matching path to the current route requested, Pages will serve it. Pages...
Read more >
Changelog - Cypress Documentation
Users can now log into the Dashboard from the "Choose a browser" page of the Launchpad even if a browser is not open....
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