Closed thomaspaillot closed 3 months ago
Hi @thomaspaillot
By default, path-to-regexp does not handle paths with parentheses unless they are properly escaped or used in a way that the library expects.
Sanitizing your paths with the use of escape characters is the recommended approach to handling pattern matches on params for pathToRegexp
Alternatively you could implement some custom parsing logic if the use of special characters are unavoidable.
const projectId = encodeURIComponent('/:projects()/all');
this.$router.push(`/projects/${projectId}/all`);
It's Nuxt that is generating the path automatically so I cannot change this unfortunately. I'll use my custom provider if you're not willing to change this but keep in mind that this affects all Nuxt users.
Hi @thomaspaillot
We've added a task to our backlog to investigate this further and consider solutions. We'll make sure to post any updates on this thread.
Hi @thomaspaillot
I'm just reaching out to let you know that we have release a new version of the BugSnag JS Performance SDK (v2.8.0) which should solve the vue router issue you are facing. If you are still receiving this same issue after updating to the latest version, please let us know and we can investigate further.
Thanks for this new release, I'll upgrade and replace my custom provider and let you know if it's not working but I took a look at your implementation and it's quite similar to what I did in my custom provider so hopefully it shoud work.
Describe the bug
Vue router route path can contain parenthesis at the end of a dynamic param like this /:projects()/all and when you use path-to-regexp to match a potential url the regex generated by path-to-regexp doesn't work because of the parenthesis.
Steps to reproduce
Environment
Example Repo
Reproduction
Possible fix
I tried to use
createRouterMatcher
function from vue-router and it seems to works (I didn't flatten the routes as getRoutes() was already a flat array in my case):