Skip to content

Metric monitor shows 'Deactivated user' when created in superuser mode #117775

@kpujjigit

Description

@kpujjigit

Description

When a metric monitor is created in superuser mode on behalf of an organization, the Created By field in the monitor Details panel shows "Deactivated user" instead of an accurate label.

Root Cause

The DetectorExtraDetails.CreatedBy component calls useUserFromId, which fetches the creator via /organizations/{org}/users/{userId}/. This endpoint only returns users who are members of the org. A superuser acting on behalf of an org is not an org member, so the request returns 404 → isError = true → the component renders t('Deactivated user').

The 404 path is intentionally handled as "Deactivated user" (extraDetails.tsx line 76–78), but it conflates two distinct cases:

  • User account is genuinely deactivated or deleted
  • User exists and is active, but is not a member of this org (e.g. a superuser)

Relevant files:

  • static/app/views/detectors/components/details/common/extraDetails.tsx
  • static/app/utils/useUserFromId.tsx
  • src/sentry/incidents/logic.pyuser_id=user.id stored on AlertRuleActivity.CREATED

Impact

Org admins see "Deactivated user" on monitors created on their behalf via superuser, with no indication that the creator was Sentry staff. The label is factually incorrect and likely to cause confusion or false concern about user account health.

Expected Behavior

When /organizations/{org}/users/{userId}/ returns 404, the component should distinguish between a truly deactivated user and a user who simply isn't an org member (e.g. show "Sentry", consistent with the existing null createdBy path, or "Sentry staff").

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status
    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions