Skip to content

Commit b71fcb5

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

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/replay/src/util/prepareReplayEvent.ts

Lines changed: 9 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,10 +21,17 @@ 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,
2936
)) as ReplayEvent | null;
3037

0 commit comments

Comments
 (0)