test: use a syntactically valid domain in middleware test#54
Merged
Conversation
The middleware test passed '<domain>' as the Auth0 domain. Since @auth0/auth0-server-js 1.6.0, the ServerClient constructor validates the domain via new URL(), which throws 'Invalid URL' on the '<' / '>' characters — so getUser() failed and the test broke on any install resolving >=1.6.0. The repo intentionally ships no package-lock (#42), so fresh installs now resolve the newer SDK and surface this. Use 'example.auth0.local', a syntactically valid host that never resolves, so the test is robust across SDK versions without making network calls.
📝 WalkthroughWalkthroughIn the middleware test file, the ChangesMiddleware Test Domain Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~1 minute Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
sanchitmehtagit
approved these changes
Jun 23, 2026
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.
Summary
The
auth.servermiddleware test passed the literal placeholder'<domain>'as the Auth0 domain. Since @auth0/auth0-server-js 1.6.0, theServerClientconstructor validates the domain by running it throughnew URL()(added with the resolver/multi-domain support).new URL('https://<domain>')throwsInvalid URLbecause<and>are illegal in a hostname, sogetUser()throws and the test fails.Change
domain: '<domain>'→domain: 'example.auth0.local'inmiddleware.test.ts— a syntactically valid host that never resolves (no network calls), so the test is robust across SDK versions.Verification
middleware.test.tspasses against server-js 1.6.1 (the version a fresh install resolves)Summary by CodeRabbit