-
-
Notifications
You must be signed in to change notification settings - Fork 20.9k
Description
β Description:
In Express v5.1.0, routes using app.all('*') (or similar wildcard syntax) fail with:
Error πΉ: throw new TypeError(Missing parameter name at ${i}: ${DEBUG_URL}
);
This change comes from stricter path-to-regexp parsing rules.
In Express v4, the following code worked fine:
app.all('*', (req, res) => res.send('Not Found'));
But in Express v5, developers are forced to write:
app.all('/*splat', (req, res) => res.send('Not Found'));
// or
app.all('/{*splat}', (req, res) => res.send('Not Found'));
This breaks a very common catch-all route pattern used widely in v4 projects.
π Root Cause
1.Express v5 migrated to a stricter version of path-to-regexp.
2.Unnamed wildcards (*) are no longer allowed.
3.Developers must now explicitly name the wildcard parameter.
β Expected Behavior
Express v5 should either:
Gracefully support app.all('*') as a valid catch-all syntax (to maintain backward compatibility).
Or, if strict syntax is required:
Provide a clearer error message explaining the new requirement.
Update docs & migration guide to emphasize the change prominently.
π Suggested Fixes
Restore legacy * wildcard syntax support (backward compatibility).
Or provide an explicit alternative (e.g. app.all('/*')) documented as the replacement.
Improve error messaging in path-to-regexp.
π Related Issue
This request builds upon Issue #6664 where the problem was first reported. Maintainers clarified that this is not a bug but an intentional change β hence this formal feature request.