Skip to content

fix(sentry_apps): Treat missing servicehook as halt, not error - #123709

Draft
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/sentry-app-missing-servicehook-halt
Draft

fix(sentry_apps): Treat missing servicehook as halt, not error#123709
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/sentry-app-missing-servicehook-halt

Conversation

@sentry

@sentry sentry Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Previously, sentry.sentry_apps.tasks.sentry_apps.send_webhooks would raise a SentryAppSentryError(MISSING_SERVICEHOOK) when no ServiceHook was found for an installation. This was incorrectly treated as a runtime failure, generating a high volume of noisy Sentry issues (~783k events).

This change reclassifies a missing ServiceHook as an expected halt condition, similar to APP_DISABLED.

Changes:

  • Added MISSING_SERVICEHOOK to SentryAppWebhookHaltReason enum.
  • Modified send_webhooks to call lifecycle.record_halt(halt_reason=SentryAppWebhookHaltReason.MISSING_SERVICEHOOK) and return, instead of raising an error.
  • Updated the corresponding unit test (test_does_not_send_if_no_service_hook_exists) to assert for a halt outcome instead of a failure.

Legal 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.

Fixes SENTRY-5HA0

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 45ee9fa in this run:

tests/sentry/sentry_apps/tasks/test_sentry_apps.py::TestWorkflowNotification::test_does_not_send_if_no_service_hook_existslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/sentry_apps/tasks/test_sentry_apps.py:1661: in test_does_not_send_if_no_service_hook_exists
    workflow_notification(install.id, self.issue.id, "assigned", self.user.id)
src/sentry/silo/base.py:157: in override
    return original_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/taskbroker_client/task.py:142: in __call__
    return self._func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/sentry_apps/tasks/sentry_apps.py:575: in workflow_notification
    send_webhooks(installation=install, event=event, data=data, actor=user)
src/sentry/sentry_apps/tasks/sentry_apps.py:828: in send_webhooks
    raise SentryAppSentryError(
E   sentry.sentry_apps.utils.errors.SentryAppSentryError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants