Multiple Optional Catchall Routes with overlapping patterns fails to correctly fall-back in dev mode
See original GitHub issueBug report
Describe the bug
While next is in dev mode, it fails to build appropriate catchall route when multiple catchalls exist with overlapping patterns. For example, a page at pages/[[...foo]].js/
will not be built if pages/[bar]/[[...bazz.js]]
exists, until first navigating to the homepage /
to force a build of [[...foo]]
To Reproduce
Created an example branch with this behavior https://github.com/brandondc741/next-catchall-route-bug
Repro steps are located in https://github.com/brandondc741/next-catchall-route-bug/blob/master/HOW_TO_REPLICATE_ISSUE.md
npx next dev
- First visit /foo/root
- Observe 404
- visit /
- Observe page renders, [[…slug]] builds
- visit /foo/root
- Observe page now renders
Expected behavior
In dev mode, when next.js is given the path /foo/root
it should
- Attempt to render
pages/[firstSegment]/[[...nestedSlug]].js
- Fall-back to attempting to render
[[...slug]].js
System information
- OS: macOS
- Version of Next.js: 9.5.3
- Version of Node.js: 12.18.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
NextJS Optional catch all routes not working when deployed
The issue is, the optional catch-all are not workink properly whenever the pages are statically generated. Ex: productId/contentOne does not ...
Read more >Supplemental Document: Log Messages Reference - AskF5
The Scrubber Route Domain (%s) has a destination IP (%s) that overlaps with (%s). 01071ceb, Operation failed for CA bundle manager %s due...
Read more >Configuring and managing networking Red Hat Enterprise ...
Configuring multiple Ethernet interfaces using a single connection profile ... Optional: Configure the behavior if NetworkManager does not receive an IPv4 ...
Read more >8. Configuration Reference — BIND 9 9.18.8 documentation
Similarly, the listen-on option causes the server to refuse queries on any of ... BIND to fall back to normal (non-minimized) query mode...
Read more >Cisco Collaboration System 12.x Solution Reference Network ...
Do not assign a single route filter to too many route patterns. ... selected so that it does not cause overlap with any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m experiencing a similar issue. I have the following structure
pages/foo/[…slug].tsx pages/[[…slug]].tsx
In the catchAllRoute of [[…slug]].tsx in the root, there exists a page foo/xy that is not covered by the filter in
getStaticPaths
of the […slug].tsx inside foo. In the dev mode the application runs into an error calling foo/xy. With build and start it works fine on the first call but when revalidate fires, the error is still there.We managed to identify the possible cause of this bug: When running in the dev mode
getStaticPaths
is “ignored” because there is no static generation --> the call arrives in [slug].tsx inside foo and jumps intogetStaticProps
and tries to render the page from there without looking it up in [[…slug]].tsx in the root. While building,getStaticPaths
is taken into account and everything renders as it should. Then (in our case) revalidate fires and again we directly jump intogetStaticProps
of the […slug].tsx inside foo.A fix of this bug should consider the overlapping catchAllRoutes based on their filter in
getStaticPaths
also in revalidate and dev mode.Hey, I am new to open source. Can I try to work on this issue?