From 538285aaa81425253e3c866308a8cab030636c91 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 22 Mar 2023 17:16:14 +0100 Subject: [PATCH] fix: Ensure `ignoreErrors` only applies to error events --- packages/core/src/integrations/inboundfilters.ts | 3 ++- .../test/lib/integrations/inboundfilters.test.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/inboundfilters.ts index 047060ae4961..e790e3daf4b5 100644 --- a/packages/core/src/integrations/inboundfilters.ts +++ b/packages/core/src/integrations/inboundfilters.ts @@ -103,7 +103,8 @@ export function _shouldDropEvent(event: Event, options: Partial): boolean { - if (!ignoreErrors || !ignoreErrors.length) { + // If event.type, this is not an error + if (event.type || !ignoreErrors || !ignoreErrors.length) { return false; } diff --git a/packages/core/test/lib/integrations/inboundfilters.test.ts b/packages/core/test/lib/integrations/inboundfilters.test.ts index ff9aca20270a..7537f19d4d5d 100644 --- a/packages/core/test/lib/integrations/inboundfilters.test.ts +++ b/packages/core/test/lib/integrations/inboundfilters.test.ts @@ -177,6 +177,11 @@ const MALFORMED_EVENT: Event = { }, }; +const TRANSACTION_EVENT: Event = { + message: 'transaction message', + type: 'transaction', +}; + describe('InboundFilters', () => { describe('_isSentryError', () => { it('should work as expected', () => { @@ -202,6 +207,13 @@ describe('InboundFilters', () => { expect(eventProcessor(MESSAGE_EVENT, {})).toBe(null); }); + it('ignores transaction event for filtering', () => { + const eventProcessor = createInboundFiltersEventProcessor({ + ignoreErrors: ['transaction'], + }); + expect(eventProcessor(TRANSACTION_EVENT, {})).toBe(TRANSACTION_EVENT); + }); + it('string filter with exact match', () => { const eventProcessor = createInboundFiltersEventProcessor({ ignoreErrors: ['captureMessage'],