Skip to content

Commit c335d95

Browse files
committed
remove circular json hacks
1 parent ef30920 commit c335d95

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

packages/core/src/baseclient.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
446446
}
447447

448448
return result.then(evt => {
449-
if (evt) {
450-
// TODO this is more of the hack trying to solve https://github.com/getsentry/sentry-javascript/issues/2809
451-
// it is only attached as extra data to the event if the event somehow skips being normalized
452-
evt.sdkProcessingMetadata = {
453-
...evt.sdkProcessingMetadata,
454-
normalizeDepth: `${normalize(normalizeDepth)} (${typeof normalizeDepth})`,
455-
};
456-
}
457449
if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
458450
return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
459451
}
@@ -525,8 +517,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
525517
});
526518
}
527519

528-
normalized.sdkProcessingMetadata = { ...normalized.sdkProcessingMetadata, baseClientNormalized: true };
529-
530520
return normalized;
531521
}
532522

packages/core/src/envelope.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,12 @@ export function createEventEnvelope(
7373
const { transactionSampling } = event.sdkProcessingMetadata || {};
7474
const { method: samplingMethod, rate: sampleRate } = transactionSampling || {};
7575

76-
// TODO: Below is a temporary hack in order to debug a serialization error - see
77-
// https://github.com/getsentry/sentry-javascript/issues/2809,
78-
// https://github.com/getsentry/sentry-javascript/pull/4425, and
79-
// https://github.com/getsentry/sentry-javascript/pull/4574.
80-
//
81-
// TL; DR: even though we normalize all events (which should prevent this), something is causing `JSON.stringify` to
82-
// throw a circular reference error.
83-
//
84-
// When it's time to remove it:
85-
// 1. Delete everything between here and where the request object `req` is created, EXCEPT the line deleting
86-
// `sdkProcessingMetadata`
87-
// 2. Restore the original version of the request body, which is commented out
88-
// 3. Search for either of the PR URLs above and pull out the companion hacks in the browser playwright tests and the
89-
// baseClient tests in this package
9076
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
91-
event.tags = event.tags || {};
92-
event.extra = event.extra || {};
9377

94-
// In theory, all events should be marked as having gone through normalization and so
95-
// we should never set this tag/extra data
96-
if (!(event.sdkProcessingMetadata && event.sdkProcessingMetadata.baseClientNormalized)) {
97-
event.tags.skippedNormalization = true;
98-
event.extra.normalizeDepth = event.sdkProcessingMetadata ? event.sdkProcessingMetadata.normalizeDepth : 'unset';
99-
}
100-
101-
// prevent this data from being sent to sentry
102-
// TODO: This is NOT part of the hack - DO NOT DELETE
78+
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
79+
// sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
80+
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
81+
// of this `delete`, lest we miss putting it back in the next time the property is in use.)
10382
delete event.sdkProcessingMetadata;
10483

10584
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);

0 commit comments

Comments
 (0)