fix: improve error message for invalid issuer URL in OAuth/OIDC flow … #13338
+17
−2
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.
…- Add try-catch block around URL constructor for issuer - Include the invalid URL value in error message - Provide helpful context about expected URL format - Makes debugging OAuth/OIDC configuration issues easier Before: 'Invalid URL' After: 'Invalid issuer URL: "invalid-url". The issuer must be a valid URL.' Fixes Issue number #13234
☕️ Reasoning
When an invalid URL is provided in the
issuerconfiguration during OAuth/OIDC authentication setup, the error message only displays "Invalid URL" without showing which URL value was problematic. This makes debugging configuration issues unnecessarily difficult for developers.This PR improves the error message by:
new URL(provider.issuer!)constructorBefore:
After:
Testing:
Tested locally using the dev app (
pnpm dev) with various invalid URL formats:"invalid-url-test"- missing protocol scheme"not-a-valid-url"- completely invalid format"https://signin/redirectTo=home"- malformed URLAll test cases now clearly display the problematic URL value in the error message, making it immediately obvious what needs to be fixed in the configuration.
This makes it immediately clear what configuration value needs to be fixed, significantly improving the developer experience.
🧢 Checklist
"invalid-url-test""not-a-valid-url""https://signin/redirectTo=home"🎫 Affected issues
Fixes: #13234
📌 Resources