-
-
Notifications
You must be signed in to change notification settings - Fork 23k
Using wildcard routes "*" or "/*" in Express v5 causes path-to-regexp to throw an error due to broken parameter parsing. #6606
Copy link
Copy link
Closed as duplicate of#6428
Copy link
Labels
Description
Issue: Using wildcard routes * or /* in Express v5 causes path-to-regexp to throw an error due to broken parameter parsing.
Error:
/home/*****/node_modules/path-to-regexp/dist/index.js:73
throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);
^
TypeError: Missing parameter name at 2: https://git.new/pathToRegexpError
at name (/home/*****/node_modules/path-to-regexp/dist/index.js:73:19)
at lexer (/home/*****/node_modules/path-to-regexp/dist/index.js:91:27)
at lexer.next (<anonymous>)
at Iter.peek (/home/*****/node_modules/path-to-regexp/dist/index.js:106:38)
at Iter.tryConsume (/home/*****/node_modules/path-to-regexp/dist/index.js:112:28)
at Iter.text (/home/*****/node_modules/path-to-regexp/dist/index.js:128:30)
at consume (/home/*****/node_modules/path-to-regexp/dist/index.js:152:29)
at parse (/home/*****/node_modules/path-to-regexp/dist/index.js:183:20)
at /home/*****/node_modules/path-to-regexp/dist/index.js:294:74
at Array.map (<anonymous>)
Details:
When defining routes with * or /* patterns in Express 5.x, path-to-regexp fails to parse the route pattern properly, throwing a Missing parameter name error. This breaks wildcard routing functionality.
Environment information
Version:
"dependencies": {
"express": "^5.1.0",
"sqlite3": "^5.1.7"
}
Platform:
Ubuntu 24.04.2 LTS
Node.js version:
Node.js v22.17.0
What steps will reproduce the bug?
- Define a route in Express v5 using the wildcard patterns
*or/*.
const app = express();
app.get('/*', (req, res) => {
res.send('Wildcard route');
});
app.listen(3000, () => {
console.log('Server started on port 3000');
});
-
Start the Node.js server with this route configuration.
-
Access any path (e.g.,
http://localhost:3000/anything) in a browser or HTTP client. -
The server will throw a
TypeError: Missing parameter namefrompath-to-regexp, causing the crash.
Reactions are currently unavailable