Catch-all routes aren't parsed properly
See original GitHub issueDescribe the bug
Using a catch-all route with format [[...paramName]].tsx
leads to a path-to-regexp error when deploying
To Reproduce
- 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. - Attempt deploy (
serverless
) - 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.
TypeError: Missing parameter name at 12
Desktop (please complete the following information):
- OS: macOS Catalina 10.15.1
- Version @sls-next/serverless-component@1.16.0-alpha.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (4 by maintainers)
Top 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 >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
As a workaround for optional catch-all routes, instead of, say,
pages/posts/[[...params]].js
you can createpages/posts/index.js
andpages/posts/[...params].js
where[...params].js
is justNow
/posts
route will renderindex.js
withrouter.query === {}
, and/posts/published/recent
will also renderindex.js
but withrouter.query.params === ['published', 'recent']
.That warning has disappeared from docs, so maybe Optional catch all routes now should be supported? I am getting the same error.