@sentry/browser 6.17.0 → 6.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.17.0 (ad2f4ad) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.17.1 (97cf273) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /**
4
4
  * TODO(v7): Remove this enum and replace with SeverityLevel
@@ -3861,10 +3861,7 @@ var Sentry = (function (exports) {
3861
3861
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3862
3862
  normalized.contexts.trace = event.contexts.trace;
3863
3863
  }
3864
- const { _experiments = {} } = this.getOptions();
3865
- if (_experiments.ensureNoCircularStructures) {
3866
- return normalize(normalized);
3867
- }
3864
+ event.sdkProcessingMetadata = Object.assign(Object.assign({}, event.sdkProcessingMetadata), { baseClientNormalized: true });
3868
3865
  return normalized;
3869
3866
  }
3870
3867
  /**
@@ -4165,10 +4162,56 @@ var Sentry = (function (exports) {
4165
4162
  const useEnvelope = eventType === 'transaction' || !!api.tunnel;
4166
4163
  const { transactionSampling } = event.sdkProcessingMetadata || {};
4167
4164
  const { method: samplingMethod, rate: sampleRate } = transactionSampling || {};
4165
+ // TODO: Below is a temporary hack in order to debug a serialization error - see
4166
+ // https://github.com/getsentry/sentry-javascript/issues/2809 and
4167
+ // https://github.com/getsentry/sentry-javascript/pull/4425. TL;DR: even though we normalize all events (which should
4168
+ // prevent this), something is causing `JSON.stringify` to throw a circular reference error.
4169
+ //
4170
+ // When it's time to remove it:
4171
+ // 1. Delete everything between here and where the request object `req` is created, EXCEPT the line deleting
4172
+ // `sdkProcessingMetadata`
4173
+ // 2. Restore the original version of the request body, which is commented out
4174
+ // 3. Search for `skippedNormalization` and pull out the companion hack in the browser playwright tests
4175
+ enhanceEventWithSdkInfo(event, api.metadata.sdk);
4176
+ event.tags = event.tags || {};
4177
+ event.extra = event.extra || {};
4178
+ // In theory, all events should be marked as having gone through normalization and so
4179
+ // we should never set this tag
4180
+ if (!(event.sdkProcessingMetadata && event.sdkProcessingMetadata.baseClientNormalized)) {
4181
+ event.tags.skippedNormalization = true;
4182
+ }
4168
4183
  // prevent this data from being sent to sentry
4184
+ // TODO: This is NOT part of the hack - DO NOT DELETE
4169
4185
  delete event.sdkProcessingMetadata;
4186
+ let body;
4187
+ try {
4188
+ // 99.9% of events should get through just fine - no change in behavior for them
4189
+ body = JSON.stringify(event);
4190
+ }
4191
+ catch (err) {
4192
+ // Record data about the error without replacing original event data, then force renormalization
4193
+ event.tags.JSONStringifyError = true;
4194
+ event.extra.JSONStringifyError = err;
4195
+ try {
4196
+ body = JSON.stringify(normalize(event));
4197
+ }
4198
+ catch (newErr) {
4199
+ // At this point even renormalization hasn't worked, meaning something about the event data has gone very wrong.
4200
+ // Time to cut our losses and record only the new error. With luck, even in the problematic cases we're trying to
4201
+ // debug with this hack, we won't ever land here.
4202
+ const innerErr = newErr;
4203
+ body = JSON.stringify({
4204
+ message: 'JSON.stringify error after renormalization',
4205
+ // setting `extra: { innerErr }` here for some reason results in an empty object, so unpack manually
4206
+ extra: { message: innerErr.message, stack: innerErr.stack },
4207
+ });
4208
+ }
4209
+ }
4170
4210
  const req = {
4171
- body: JSON.stringify(sdkInfo ? enhanceEventWithSdkInfo(event, api.metadata.sdk) : event),
4211
+ // this is the relevant line of code before the hack was added, to make it easy to undo said hack once we've solved
4212
+ // the mystery
4213
+ // body: JSON.stringify(sdkInfo ? enhanceEventWithSdkInfo(event, api.metadata.sdk) : event),
4214
+ body,
4172
4215
  type: eventType,
4173
4216
  url: useEnvelope
4174
4217
  ? getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel)
@@ -4217,7 +4260,7 @@ var Sentry = (function (exports) {
4217
4260
  hub.bindClient(client);
4218
4261
  }
4219
4262
 
4220
- const SDK_VERSION = '6.17.0';
4263
+ const SDK_VERSION = '6.17.1';
4221
4264
 
4222
4265
  let originalFunctionToString;
4223
4266
  /** Patch toString calls to return proper name for wrapped functions */