Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lucas-devx opened this issue May 16, 2025 · 1 comment

Comments

@lucas-devx
Copy link

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.

@getsantry
Copy link

getsantry bot commented May 16, 2025

Assigning to @getsentry/support for routing ⏲️

@getsantry getsantry bot moved this to Waiting for: Support in GitHub Issues with 👀 3 May 16, 2025
@cobyeastwood183 cobyeastwood183 transferred this issue from getsentry/sentry May 16, 2025
@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 3 May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Development

No branches or pull requests

2 participants