Solution skill
Fix: beforeSend silently dropping every event
Complete solution
Shows how to fix fix: beforeSend silently dropping every event. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "// drops everything that is not a TypeError": add a temporary log line inside beforeSend printing the event ID and the return value. Remove the log line, keep the explicit return, and confirm events flow.
// drops everything that is not a TypeError
Sentry.init({
beforeSend(event) {
if (event.exception.values[0].type === "TypeError") {
return event;
}
// implicit undefined for everything else
},
});Steps
beforeSendmust return the event. If it returnsnullorundefined, the event is discarded silently, by design. The usual ways this happens:
// drops EVERYTHING: no return statement
Sentry.init({
beforeSend(event) {
scrub(event);
},
});// drops everything that is not a TypeError
Sentry.init({
beforeSend(event) {
if (event.exception.values[0].type === "TypeError") {
return event;
}
// implicit undefined for everything else
},
});- Arrow-function bodies without braces have the same trap:
beforeSend: (e) => { scrub(e); }returns undefined. - Always return the event at the end, and return
nullonly deliberately:
beforeSend(event) {
scrub(event);
if (shouldIgnore(event)) return null; // deliberate drop
return event; // everything else ships
}- Add a temporary log line inside
beforeSendprinting the event ID and the return value. If the log fires but nothing arrives, the hook is eating events. If the log never fires, the problem is earlier (init order, DSN, transport). - Remove the log line, keep the explicit return, and confirm events flow. As a rule, treat any
beforeSendwithout a finalreturn eventas a bug during code review.
When to use
You are seeing this: No errors in the SDK logs, no failed requests, no quota issues. Use this skill when you run into "Fix: beforeSend silently dropping every event".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
beforeSend must return the event.
Evidence
Researched against live Sentry docs 2026-09-26. The JS filtering page (docs.sentry.io/platforms/javascript/configuration/filtering/) documents beforeSend: it runs before the event is sent and returning null/undefined drops the event. The Python filtering page (docs.sentry.io/platforms/python/configuration/filtering/) documents the same before_send contract.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_2-ag04SzRdBoH_pixLlhDA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fix: beforeSend silently dropping every event <span>— Vectle</span></a>