fix(sentry-apps): Handle empty webhook_url in external requests#109529
Merged
GabeVillalobos merged 3 commits intomasterfrom Mar 2, 2026
Merged
fix(sentry-apps): Handle empty webhook_url in external requests#109529GabeVillalobos merged 3 commits intomasterfrom
GabeVillalobos merged 3 commits intomasterfrom
Conversation
e797c3b to
a0b0c0b
Compare
Christinarlong
approved these changes
Mar 2, 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.
This PR fixes the
MissingSchemaerror that occurred when Sentry App external requests were made with an emptywebhook_url.Root Cause:
The
urlparse()function, when given an empty string (''), returns aParseResultwith all components (scheme, netloc, path) empty. When subsequent URL building logic (e.g., inSelectRequester._build_url()) then attempts to construct a URL by replacing only the path or netloc, it results in a relative URL (e.g.,/sentry/issues?...) that lacks a scheme. Therequestslibrary, used bysafe_urlopen, then rejects this malformed URL with aMissingSchemaexception.Fix:
Early validation has been added to the
_build_url()methods inSelectRequester,AlertRuleActionRequester,IssueLinkRequester, and the_prepare_stacktrace_link()method incomponents.py. These checks now explicitly raise aSentryAppIntegratorErrorifself.sentry_app.webhook_urlis empty orNone. This ensures that:requestslibrary.SentryAppIntegratorErroris raised, providing clearer context (e.g.,MISSING_URL) to the user and for internal logging, instead of the genericMissingSchema.run()methods can gracefully process this specific error type.Affected Files:
src/sentry/sentry_apps/external_requests/select_requester.pysrc/sentry/sentry_apps/external_requests/alert_rule_action_requester.pysrc/sentry/sentry_apps/external_requests/issue_link_requester.pysrc/sentry/sentry_apps/components.pyLegal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.