Skip to content

beforeSend is not called for user feedback #13001

@p-himik

Description

@p-himik

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

8.19.0

Framework Version

React 17.0.2

Link to Sentry event

No response

SDK Setup/Reproduction Example

No response

Steps to Reproduce

  1. Log what's going on in beforeSend
  2. Use captureFeedback
  3. Check the logs

Expected Result

The docstring of beforeSend says:

An event-processing callback for error and message events, guaranteed to be invoked after all other event
processors, which allows an event to be modified or dropped.

I don't know how exactly to interpret "message events", but to me it seems generic enough to include user feedback events as well.
Of course, I might be missing something, but judging by the source code of processBeforeSend, beforeSend isn't called at all for anything but errors.

My particular use-case is that I put a lot of data into breadcumbs that I then preprocess in beforeSend. I want to avoid doing it when nothing is actually being sent to avoid doing extra work.
I'm now trying to switch from capturing user feedback with uncaught exception to an explicit call to captureFeedback, but it seems that it's not possible at the moment.

Given that beforeSend is used only for errors and only accepts ErrorEvent, it might make sense to add beforeSendFeedback or some more generic version of beforeSend.

Actual Result

beforeSend is never called for feedback messages.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions