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.

Catch-all routes aren't parsed properly

See original GitHub issue

Describe the bug Using a catch-all route with format [[...paramName]].tsx leads to a path-to-regexp error when deploying

To Reproduce

  1. Using a Next.js project set-up with a minimal serverless.yml file (as per the README), add a file named [[...template]].tsx under pages. A minimal Next.js page can be used for the content.
  2. Attempt deploy (serverless)
  3. See error in console

Expected behavior Deployment should occur without issues. This is the case for me when I rename [[...paramName]].tsx to [...paramName].tsx. Furthermore, debugging shows that this is the route that is causing issues.

Screenshots If applicable, add screenshots to help explain your problem. image

TypeError: Missing parameter name at 12

Desktop (please complete the following information):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
kulesacommented, Nov 3, 2020

As a workaround for optional catch-all routes, instead of, say, pages/posts/[[...params]].js you can create pages/posts/index.js and pages/posts/[...params].js where [...params].js is just

export { default } from '.'

Now /posts route will render index.js with router.query === {}, and /posts/published/recent will also render index.js but with router.query.params === ['published', 'recent'].

4reactions
ivanpetrushevcommented, Sep 4, 2020

That warning has disappeared from docs, so maybe Optional catch all routes now should be supported? I am getting the same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Asp.net MVC Route class that supports catch-all parameter ...
When route segment is defined as greedy, reverse parsing and go to the last segment. Parse route segments one by one backwards (assigning...
Read more >
Handling HTML5 Client Route Fallbacks in ASP.NET Core
In this post I look at why HTML5 client routes require server ... hash logic is executed as part of the native URL...
Read more >
Vue 3 Catch All / 404 Route Not Found | Vue-Router Mastery #2
In this video we take a look at how to setup a fallback inside of your vue application for when a route is...
Read more >
Routing in ASP.NET Core - Microsoft Learn
See catch-all in the Route templates section for important information on ... All route values parsed from the URL are stored as strings....
Read more >
Fast request routing using regular expressions - nikic's Blog
The only thing I'll be considering in this post is the dispatch stage - how the routes are parsed or the dispatcher data...
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