chore(nextjs): Add tests covering the new middleware matcher #3741
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The matcher we currently document breaks Clerk for the following scenario.
/articles/:article-slug
.:article-slug
would be something like${article_title}_${article_id}
, eg:/article/hello-team-support_123a
- pretty common stuff so far.If an article contains a
.
in its name, eg/article/i-use-clerk.com-and-why-you-should-too_123
, thenauth()
and related helpers will fail because the matcher will not match the request URL and the middleware will be skipped.This bug recently hit a few customers. This PR updates the matcher with a simplified version that no longer handles files as an edge case. We want to update our own dashboard first to further test the new matcher, before we reach out to the customers with the updated version.
The new matcher works for all cases tested in this PR. In comparison, the old matcher we used (shown below) failed for at least the following cases:
Important: any change here needs to be reflected in the docs + the dashboard quickstart page.
For reference, the old matcher was:
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change