chore(nextjs): Add tests covering the new middleware matcher - #3741
Merged
Conversation
|
nikosdouvlis
force-pushed
the
nikos/add-matcher-test
branch
from
July 17, 2024 12:15
a07ac4d to
be38bd2
Compare
dimkl
approved these changes
Jul 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-slugwould 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 testruns as expected.npm run buildruns as expected.Type of change