Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another broken Regular Expression route #492

Open
devinellis opened this issue Sep 22, 2021 · 2 comments
Open

Another broken Regular Expression route #492

devinellis opened this issue Sep 22, 2021 · 2 comments

Comments

@devinellis
Copy link

I think this is related to #476

SyntaxError: Invalid regular expression: /stk_design_library(?:/: Unterminated group
    at new RegExp (<anonymous>)
    at reduceRouteComponents (/var/www/node_modules/wpapi/lib/route-tree.js:83:3)
    at Array.reduce (<anonymous>)
    at reduceRouteTree (/var/www/node_modules/wpapi/lib/route-tree.js:182:18)
    at /var/www/node_modules/wpapi/lib/util/object-reduce.js:25:20
    at Array.reduce (<anonymous>)
    at module.exports (/var/www/node_modules/wpapi/lib/util/object-reduce.js:24:3)
    at buildRouteTree (/var/www/node_modules/wpapi/lib/route-tree.js:200:9)
    at WPAPI.bootstrap (/var/www/node_modules/wpapi/wpapi.js:349:23)
    at new WPAPI (/var/www/node_modules/wpapi/wpapi.js:88:4)
Endpoint detected, proceeding despite error...
Binding to https://<redacted>/wp-json/ and assuming default routes

The route key in the JSON body is /wp/v2/stk_design_library(?:/(?P<reset>reset))?

What I am trying to achieve is to get the /plugins routes to mount, and they don't seem to be included in the "default routes" mentioned in the error log. This makes me wonder, why not test each key and skip it instead of throwing out the whole thing? (I am making assumptions here)

Thanks in advance for the help!

@devinellis
Copy link
Author

Since I didn't hear back I ended up removing WPAPI as a dependency, and instead make node-fetch calls directly for the endpoints I need.

@samfreedman
Copy link

This looks like the same issue as #503?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants