Skip to content

Commit d9075a0

Browse files
committed
fix(replay): Ensure replay events go through preprocessEvent hook
1 parent 042e7ce commit d9075a0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/replay/src/util/prepareReplayEvent.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Scope } from '@sentry/core';
22
import { prepareEvent } from '@sentry/core';
33
import type { IntegrationIndex } from '@sentry/core/build/types/integration';
4-
import type { Client, ReplayEvent } from '@sentry/types';
4+
import type { Client, EventHint, ReplayEvent } from '@sentry/types';
55

66
/**
77
* Prepare a replay event & enrich it with the SDK metadata.
@@ -21,11 +21,19 @@ export async function prepareReplayEvent({
2121
typeof client._integrations === 'object' && client._integrations !== null && !Array.isArray(client._integrations)
2222
? Object.keys(client._integrations)
2323
: undefined;
24+
25+
const eventHint: EventHint = { event_id, integrations };
26+
27+
if (client.emit) {
28+
client.emit('preprocessEvent', event, eventHint);
29+
}
30+
2431
const preparedEvent = (await prepareEvent(
2532
client.getOptions(),
2633
event,
27-
{ event_id, integrations },
34+
eventHint,
2835
scope,
36+
client,
2937
)) as ReplayEvent | null;
3038

3139
// If e.g. a global event processor returned null

0 commit comments

Comments
 (0)