9.1.5 path-to-regexp error with static routes with special symbols * ( +
See original GitHub issueBug report
if you place files in public folder with symbols * ( ) + and run node server.js
in production you will get something like
/node_modules/next/node_modules/path-to-regexp/dist/index.js:80
throw new TypeError("Unbalanced pattern at " + i);
TypeError: Unexpected MODIFIER at 1, expected END
or
/node_modules/next/node_modules/path-to-regexp/dist/index.js:113
throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
^
Describe the bug
This is bug with path-to-regexp. And it happens only in 9.1.5 after upgrade path-to-regexp from version 3 to 6.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npx create-next-app --example custom-server-express custom-server-express-app
oryarn create next-app --example custom-server-express custom-server-express-app
- Create public folder
- Create any file with any symbol from * or ( or + . For example logo18+.png
- Put that file in public folder
- Run
NODE_ENV=production node server.js
Expected behavior
Route created for static svg -> server started
System information
- OS: MacOS 10.15
- Version of Next.js: 9.1.5
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cannot read property 'length' of undefined at pathtoRegexp ...
The reason behind that error is using the app.get() method without param, which expect the endpoint url and call back as parameters.
Read more >Configure Path Monitoring for a Static Route
If you decide that you want specific Layer 3 traffic to take a certain route without participating in IP routing protocols, you can...
Read more >D6.5 Collaborative Cloud Solution Platform
The development of the platform of INNOVACONCRETE project is one of the activities related to WP6 dealing with the Conservation Approaches ...
Read more >Configuring IPv4 Static Routes - Gaia Portal
conf command. For more information, see sk92799. 8. In the Comment field, enter the applicable comment text (up to 100 characters) ...
Read more >path-to-regexp - npm
Express style path to RegExp utility. Latest version: 6.2.1, last published: 8 months ago. Start using path-to-regexp in your project by ...
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 Free
Top 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
@markotom you should change usage of
*
in routes to(.*)
or:splat*
as per koajs/router v9 changelog.Fixed in
9.1.8-canary.11
– please give it a try!