@@ -55,6 +55,8 @@ export function prepareEvent(
55
55
// We prepare the result here with a resolved Event.
56
56
let result = resolvedSyncPromise < Event | null > ( prepared ) ;
57
57
58
+ const clientEventProcessors = client && client . getEventProcessors ? client . getEventProcessors ( ) : [ ] ;
59
+
58
60
// This should be the last thing called, since we want that
59
61
// {@link Hub.addEventProcessor } gets the finished prepared event.
60
62
//
@@ -73,31 +75,27 @@ export function prepareEvent(
73
75
}
74
76
75
77
// In case we have a hub we reassign it.
76
- result = finalScope . applyToEvent ( prepared , hint ) ;
78
+ result = finalScope . applyToEvent ( prepared , hint , clientEventProcessors ) ;
77
79
} else {
78
- // Apply global event processors even if there is no scope
79
- result = notifyEventProcessors ( getGlobalEventProcessors ( ) , prepared , hint ) ;
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
- return result
83
- . then ( evt => {
84
- // Process client-scoped event processors
85
- return client && client . getEventProcessors ? notifyEventProcessors ( client . getEventProcessors ( ) , evt , hint ) : evt ;
86
- } )
87
- . then ( evt => {
88
- if ( evt ) {
89
- // We apply the debug_meta field only after all event processors have ran, so that if any event processors modified
90
- // file names (e.g.the RewriteFrames integration) the filename -> debug ID relationship isn't destroyed.
91
- // This should not cause any PII issues, since we're only moving data that is already on the event and not adding
92
- // any new data
93
- applyDebugMeta ( evt ) ;
94
- }
85
+ return result . then ( evt => {
86
+ if ( evt ) {
87
+ // We apply the debug_meta field only after all event processors have ran, so that if any event processors modified
88
+ // file names (e.g.the RewriteFrames integration) the filename -> debug ID relationship isn't destroyed.
89
+ // This should not cause any PII issues, since we're only moving data that is already on the event and not adding
90
+ // any new data
91
+ applyDebugMeta ( evt ) ;
92
+ }
95
93
96
- if ( typeof normalizeDepth === 'number' && normalizeDepth > 0 ) {
97
- return normalizeEvent ( evt , normalizeDepth , normalizeMaxBreadth ) ;
98
- }
99
- return evt ;
100
- } ) ;
94
+ if ( typeof normalizeDepth === 'number' && normalizeDepth > 0 ) {
95
+ return normalizeEvent ( evt , normalizeDepth , normalizeMaxBreadth ) ;
96
+ }
97
+ return evt ;
98
+ } ) ;
101
99
}
102
100
103
101
/**
0 commit comments