Issue
I set denyUrls (or allowUrls) to drop events by script URL, but matching frames deeper in the stack still reach Sentry. Those options only check the top stack frame, so the event is sent anyway.
Applies To
All SaaS Customers and Self-Hosted Users
JavaScript browser SDKs
denyUrls,allowUrls, andbeforeSendError Monitoring
Filtering Events
Resolution
denyUrls and allowUrls only match the top stack frame’s file URL. To drop an event when any frame matches a pattern, use beforeSend and inspect every frame in the stack trace. Return null to drop the event.
Add a
beforeSendcallback inSentry.init.Read
event.exception.values[0].stacktrace.frames(guard for missing data).If any frame’s
filenamematches your pattern, returnnull. Otherwise return the event.
Sentry.init({
dsn: "___PUBLIC_DSN___",
beforeSend(event) {
const frames = event.exception?.values?.[0]?.stacktrace?.frames;
if (!frames) {
return event;
} for (const frame of frames) {
if (frame.filename && /chrome-extension/i.test(frame.filename)) {
return null;
}
} return event;
},
});
See the beforeSend filtering documentation and the denyUrls / allowUrls options.
For third-party noise more broadly, see Why is thirdPartyErrorFilterIntegration not filtering errors from outside my application? and Filtering out third party errors.
