@sentry/browser 6.17.0 → 6.17.4

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.
package/build/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.17.0 (ad2f4ad) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.17.4 (20d1bfb) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4058,10 +4058,7 @@ var Sentry = (function (exports) {
4058
4058
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4059
4059
  normalized.contexts.trace = event.contexts.trace;
4060
4060
  }
4061
- var _a = this.getOptions()._experiments, _experiments = _a === void 0 ? {} : _a;
4062
- if (_experiments.ensureNoCircularStructures) {
4063
- return normalize(normalized);
4064
- }
4061
+ event.sdkProcessingMetadata = __assign(__assign({}, event.sdkProcessingMetadata), { baseClientNormalized: true });
4065
4062
  return normalized;
4066
4063
  };
4067
4064
  /**
@@ -4369,10 +4366,56 @@ var Sentry = (function (exports) {
4369
4366
  var useEnvelope = eventType === 'transaction' || !!api.tunnel;
4370
4367
  var transactionSampling = (event.sdkProcessingMetadata || {}).transactionSampling;
4371
4368
  var _a = transactionSampling || {}, samplingMethod = _a.method, sampleRate = _a.rate;
4369
+ // TODO: Below is a temporary hack in order to debug a serialization error - see
4370
+ // https://github.com/getsentry/sentry-javascript/issues/2809 and
4371
+ // https://github.com/getsentry/sentry-javascript/pull/4425. TL;DR: even though we normalize all events (which should
4372
+ // prevent this), something is causing `JSON.stringify` to throw a circular reference error.
4373
+ //
4374
+ // When it's time to remove it:
4375
+ // 1. Delete everything between here and where the request object `req` is created, EXCEPT the line deleting
4376
+ // `sdkProcessingMetadata`
4377
+ // 2. Restore the original version of the request body, which is commented out
4378
+ // 3. Search for `skippedNormalization` and pull out the companion hack in the browser playwright tests
4379
+ enhanceEventWithSdkInfo(event, api.metadata.sdk);
4380
+ event.tags = event.tags || {};
4381
+ event.extra = event.extra || {};
4382
+ // In theory, all events should be marked as having gone through normalization and so
4383
+ // we should never set this tag
4384
+ if (!(event.sdkProcessingMetadata && event.sdkProcessingMetadata.baseClientNormalized)) {
4385
+ event.tags.skippedNormalization = true;
4386
+ }
4372
4387
  // prevent this data from being sent to sentry
4388
+ // TODO: This is NOT part of the hack - DO NOT DELETE
4373
4389
  delete event.sdkProcessingMetadata;
4390
+ var body;
4391
+ try {
4392
+ // 99.9% of events should get through just fine - no change in behavior for them
4393
+ body = JSON.stringify(event);
4394
+ }
4395
+ catch (err) {
4396
+ // Record data about the error without replacing original event data, then force renormalization
4397
+ event.tags.JSONStringifyError = true;
4398
+ event.extra.JSONStringifyError = err;
4399
+ try {
4400
+ body = JSON.stringify(normalize(event));
4401
+ }
4402
+ catch (newErr) {
4403
+ // At this point even renormalization hasn't worked, meaning something about the event data has gone very wrong.
4404
+ // Time to cut our losses and record only the new error. With luck, even in the problematic cases we're trying to
4405
+ // debug with this hack, we won't ever land here.
4406
+ var innerErr = newErr;
4407
+ body = JSON.stringify({
4408
+ message: 'JSON.stringify error after renormalization',
4409
+ // setting `extra: { innerErr }` here for some reason results in an empty object, so unpack manually
4410
+ extra: { message: innerErr.message, stack: innerErr.stack },
4411
+ });
4412
+ }
4413
+ }
4374
4414
  var req = {
4375
- body: JSON.stringify(sdkInfo ? enhanceEventWithSdkInfo(event, api.metadata.sdk) : event),
4415
+ // this is the relevant line of code before the hack was added, to make it easy to undo said hack once we've solved
4416
+ // the mystery
4417
+ // body: JSON.stringify(sdkInfo ? enhanceEventWithSdkInfo(event, api.metadata.sdk) : event),
4418
+ body: body,
4376
4419
  type: eventType,
4377
4420
  url: useEnvelope
4378
4421
  ? getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel)
@@ -4421,7 +4464,7 @@ var Sentry = (function (exports) {
4421
4464
  hub.bindClient(client);
4422
4465
  }
4423
4466
 
4424
- var SDK_VERSION = '6.17.0';
4467
+ var SDK_VERSION = '6.17.4';
4425
4468
 
4426
4469
  var originalFunctionToString;
4427
4470
  /** Patch toString calls to return proper name for wrapped functions */
@@ -5789,6 +5832,7 @@ var Sentry = (function (exports) {
5789
5832
  attachStacktrace: attachStacktrace,
5790
5833
  isRejection: false,
5791
5834
  }), url, line, column);
5835
+ event.level = exports.Severity.Error;
5792
5836
  addMechanismAndCapture(hub, error, event, 'onerror');
5793
5837
  });
5794
5838
  }