You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
beforeSend: type event_id and timestamp as required #25286
beforeSend receives an ErrorEvent, which inherits event_id?: string and timestamp?: number from Event. But by the time beforeSend runs, both are always set: _processEvent only calls processBeforeSend with the result of prepareEvent, which does
So a common beforeSend use, like showing the user the event ID in a "report this error" link, needs a ! or a fallback that can never run.
Solution Brainstorm
Type the beforeSend parameter as ErrorEvent & { event_id: string; timestamp: number } (or a named "prepared event" type), and do the same for beforeSendTransaction. This only narrows a callback parameter, so existing callbacks still type-check, and the return type can stay ErrorEvent | null.
Additional Context
@sentry/core 11.6.0
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
You're right that we can require event_id and timestamp on in the beforeSend callback. Unfortunately, this is an API breaking change for anyone calling options.beforeSend(event). For example, our React Native SDK which wraps the javascript SDK. For the React Native case, we could fix it, but it serves as a good indication that likely someone out there is doing this. I'm, going to backlog this for v12 to make the change then.
Regarding beforeSendTransaction: This API is scheduled for removal in favour of beforeSendSpan and ignoreSpans. It will be removed in v12.
Activity
linear-code commentedon Oct 12, 2026
JS-3915
Lms24 commentedon Oct 12, 2026
Hey @abrahamguo thanks for writing in!
You're right that we can require
event_idandtimestampon in thebeforeSendcallback. Unfortunately, this is an API breaking change for anyone callingoptions.beforeSend(event). For example, our React Native SDK which wraps the javascript SDK. For the React Native case, we could fix it, but it serves as a good indication that likely someone out there is doing this. I'm, going to backlog this for v12 to make the change then.Regarding
beforeSendTransaction: This API is scheduled for removal in favour ofbeforeSendSpanandignoreSpans. It will be removed in v12.