Skip to content

SDK fails to respect beforeSend mutation when DSN is undefined (edge case)Β #16317

@lucas-devx

Description

@lucas-devx

Environment

  • @sentry/react 7.91.0
  • React 18 (CRA)
  • No DSN provided intentionally (for local development)

Problem

When DSN is undefined, and beforeSend attempts to mutate the event object (e.g. strip sensitive fields), the mutation is ignored entirely and the function seems to be skipped.

Steps to Reproduce

  1. Initialize Sentry without a DSN.
  2. Add beforeSend that mutates event.extra or event.request.
  3. Log error via Sentry.captureMessage("test").

Expected Result

beforeSend still runs and mutates event before it's discarded.

Actual Result

beforeSend is silently skipped; event object remains unprocessed.

Suggestion

Perhaps invoke beforeSend even when DSN is undefined β€” for dev-mode debugging/logging flows.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions