Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const terserInstance = terser({
reserved: ['captureException', 'captureMessage', 'sentryWrapped'],
properties: {
regex: /^_[^_]/,
// This exclusion prevents most of the occurrences of the bug linked below:
// https://github.com/getsentry/sentry-javascript/issues/2622
// The bug is caused by multiple SDK instances, where one is minified and one is using non-mangled code.
// Unfortunatelly we cannot fix it reliably (thus `typeof` check in the `InboundFilters` code),
// as we cannot force people using multiple instances in their apps to sync SDK versions.
reserved: ['_mergeOptions'],
},
},
});
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ export class InboundFilters implements Integration {
if (self) {
const client = hub.getClient();
const clientOptions = client ? client.getOptions() : {};
const options = self._mergeOptions(clientOptions);
if (self._shouldDropEvent(event, options)) {
return null;
// This checks prevents most of the occurrences of the bug linked below:
// https://github.com/getsentry/sentry-javascript/issues/2622
// The bug is caused by multiple SDK instances, where one is minified and one is using non-mangled code.
// Unfortunatelly we cannot fix it reliably (thus reserved property in rollup's terser config),
// as we cannot force people using multiple instances in their apps to sync SDK versions.
const options = typeof self._mergeOptions === 'function' ? self._mergeOptions(clientOptions) : {};
if (typeof self._shouldDropEvent !== 'function') {
return event;
}
return self._shouldDropEvent(event, options) ? null : event;
}
return event;
});
Expand Down