@@ -2,6 +2,7 @@ import type { Client, ClientOptions, Event, EventHint, StackFrame, StackParser }
2
2
import { dateTimestampInSeconds , GLOBAL_OBJ , normalize , resolvedSyncPromise , truncate , uuid4 } from '@sentry/utils' ;
3
3
4
4
import { DEFAULT_ENVIRONMENT } from '../constants' ;
5
+ import { getGlobalEventProcessors , notifyEventProcessors } from '../eventProcessors' ;
5
6
import { Scope } from '../scope' ;
6
7
7
8
/**
@@ -54,6 +55,8 @@ export function prepareEvent(
54
55
// We prepare the result here with a resolved Event.
55
56
let result = resolvedSyncPromise < Event | null > ( prepared ) ;
56
57
58
+ const clientEventProcessors = client && client . getEventProcessors ? client . getEventProcessors ( ) : [ ] ;
59
+
57
60
// This should be the last thing called, since we want that
58
61
// {@link Hub.addEventProcessor } gets the finished prepared event.
59
62
//
@@ -72,11 +75,11 @@ export function prepareEvent(
72
75
}
73
76
74
77
// In case we have a hub we reassign it.
75
- result = finalScope . applyToEvent (
76
- prepared ,
77
- hint ,
78
- client && client . getEventProcessors ? client . getEventProcessors ( ) : [ ] ,
79
- ) ;
78
+ result = finalScope . applyToEvent ( prepared , hint , clientEventProcessors ) ;
79
+ } else {
80
+ // Apply client & global event processors even if there is no scope
81
+ // TODO (v8): Update the order to be Global > Client
82
+ result = notifyEventProcessors ( [ ... clientEventProcessors , ... getGlobalEventProcessors ( ) ] , prepared , hint ) ;
80
83
}
81
84
82
85
return result . then ( evt => {
0 commit comments