@sentry/replay 8.0.0-alpha.1 → 8.0.0-alpha.2
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/cjs/index.js +3 -28
- package/cjs/index.js.map +1 -1
- package/esm/index.js +4 -29
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/types/coreHandlers/handleAfterSendEvent.d.ts +1 -1
- package/types/coreHandlers/handleAfterSendEvent.d.ts.map +1 -1
- package/types/util/sendReplayRequest.d.ts +1 -1
- package/types/util/sendReplayRequest.d.ts.map +1 -1
- package/types-ts3.8/coreHandlers/handleAfterSendEvent.d.ts +1 -1
- package/types-ts3.8/util/sendReplayRequest.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -5714,10 +5714,6 @@ function isFeedbackEvent(event) {
|
|
|
5714
5714
|
* Returns a listener to be added to `client.on('afterSendErrorEvent, listener)`.
|
|
5715
5715
|
*/
|
|
5716
5716
|
function handleAfterSendEvent(replay) {
|
|
5717
|
-
// Custom transports may still be returning `Promise<void>`, which means we cannot expect the status code to be available there
|
|
5718
|
-
// TODO (v8): remove this check as it will no longer be necessary
|
|
5719
|
-
const enforceStatusCode = isBaseTransportSend();
|
|
5720
|
-
|
|
5721
5717
|
return (event, sendResponse) => {
|
|
5722
5718
|
if (!replay.isEnabled() || (!isErrorEvent(event) && !isTransactionEvent(event))) {
|
|
5723
5719
|
return;
|
|
@@ -5728,7 +5724,7 @@ function handleAfterSendEvent(replay) {
|
|
|
5728
5724
|
// We only want to do stuff on successful error sending, otherwise you get error replays without errors attached
|
|
5729
5725
|
// If not using the base transport, we allow `undefined` response (as a custom transport may not implement this correctly yet)
|
|
5730
5726
|
// If we do use the base transport, we skip if we encountered an non-OK status code
|
|
5731
|
-
if (
|
|
5727
|
+
if (!statusCode || statusCode < 200 || statusCode >= 300) {
|
|
5732
5728
|
return;
|
|
5733
5729
|
}
|
|
5734
5730
|
|
|
@@ -5784,22 +5780,6 @@ function handleErrorEvent(replay, event) {
|
|
|
5784
5780
|
});
|
|
5785
5781
|
}
|
|
5786
5782
|
|
|
5787
|
-
function isBaseTransportSend() {
|
|
5788
|
-
const client = core.getClient();
|
|
5789
|
-
if (!client) {
|
|
5790
|
-
return false;
|
|
5791
|
-
}
|
|
5792
|
-
|
|
5793
|
-
const transport = client.getTransport();
|
|
5794
|
-
if (!transport) {
|
|
5795
|
-
return false;
|
|
5796
|
-
}
|
|
5797
|
-
|
|
5798
|
-
return (
|
|
5799
|
-
(transport.send ).__sentry__baseTransport__ || false
|
|
5800
|
-
);
|
|
5801
|
-
}
|
|
5802
|
-
|
|
5803
5783
|
/**
|
|
5804
5784
|
* Returns a listener to be added to `client.on('afterSendErrorEvent, listener)`.
|
|
5805
5785
|
*/
|
|
@@ -7466,7 +7446,7 @@ async function sendReplayRequest({
|
|
|
7466
7446
|
const dsn = client && client.getDsn();
|
|
7467
7447
|
|
|
7468
7448
|
if (!client || !transport || !dsn || !session.sampled) {
|
|
7469
|
-
return;
|
|
7449
|
+
return utils.resolvedSyncPromise({});
|
|
7470
7450
|
}
|
|
7471
7451
|
|
|
7472
7452
|
const baseEvent = {
|
|
@@ -7487,7 +7467,7 @@ async function sendReplayRequest({
|
|
|
7487
7467
|
// Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
|
|
7488
7468
|
client.recordDroppedEvent('event_processor', 'replay', baseEvent);
|
|
7489
7469
|
logInfo('An event processor returned `null`, will not send event.');
|
|
7490
|
-
return;
|
|
7470
|
+
return utils.resolvedSyncPromise({});
|
|
7491
7471
|
}
|
|
7492
7472
|
|
|
7493
7473
|
/*
|
|
@@ -7549,11 +7529,6 @@ async function sendReplayRequest({
|
|
|
7549
7529
|
throw error;
|
|
7550
7530
|
}
|
|
7551
7531
|
|
|
7552
|
-
// TODO (v8): we can remove this guard once transport.send's type signature doesn't include void anymore
|
|
7553
|
-
if (!response) {
|
|
7554
|
-
return response;
|
|
7555
|
-
}
|
|
7556
|
-
|
|
7557
7532
|
// If the status code is invalid, we want to immediately stop & not retry
|
|
7558
7533
|
if (typeof response.statusCode === 'number' && (response.statusCode < 200 || response.statusCode >= 300)) {
|
|
7559
7534
|
throw new TransportStatusCodeError(response.statusCode);
|