@@ -216,8 +216,11 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
216216
217217 const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
218218 const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
219+ const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
219220
220- this . _process ( this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope ) ) ;
221+ this . _process (
222+ this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope , capturedSpanIsolationScope ) ,
223+ ) ;
221224
222225 return hintWithEventId . event_id ;
223226 }
@@ -676,8 +679,8 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
676679 protected _prepareEvent (
677680 event : Event ,
678681 hint : EventHint ,
679- currentScope = getCurrentScope ( ) ,
680- isolationScope = getIsolationScope ( ) ,
682+ currentScope : Scope ,
683+ isolationScope : Scope ,
681684 ) : PromiseLike < Event | null > {
682685 const options = this . getOptions ( ) ;
683686 const integrations = Object . keys ( this . _integrations ) ;
@@ -718,12 +721,17 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
718721 * @param hint
719722 * @param scope
720723 */
721- protected _captureEvent ( event : Event , hint : EventHint = { } , scope ?: Scope ) : PromiseLike < string | undefined > {
724+ protected _captureEvent (
725+ event : Event ,
726+ hint : EventHint = { } ,
727+ currentScope = getCurrentScope ( ) ,
728+ isolationScope = getIsolationScope ( ) ,
729+ ) : PromiseLike < string | undefined > {
722730 if ( DEBUG_BUILD && isErrorEvent ( event ) ) {
723731 logger . log ( `Captured error event \`${ getPossibleEventMessages ( event ) [ 0 ] || '<unknown>' } \`` ) ;
724732 }
725733
726- return this . _processEvent ( event , hint , scope ) . then (
734+ return this . _processEvent ( event , hint , currentScope , isolationScope ) . then (
727735 finalEvent => {
728736 return finalEvent . event_id ;
729737 } ,
@@ -756,7 +764,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
756764 * @param currentScope A scope containing event metadata.
757765 * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
758766 */
759- protected _processEvent ( event : Event , hint : EventHint , currentScope ?: Scope ) : PromiseLike < Event > {
767+ protected _processEvent (
768+ event : Event ,
769+ hint : EventHint ,
770+ currentScope : Scope ,
771+ isolationScope : Scope ,
772+ ) : PromiseLike < Event > {
760773 const options = this . getOptions ( ) ;
761774 const { sampleRate } = options ;
762775
@@ -779,12 +792,9 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
779792 ) ;
780793 }
781794
782- const dataCategory : DataCategory = eventType === 'replay_event' ? 'replay' : eventType ;
783-
784- const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
785- const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
795+ const dataCategory = ( eventType === 'replay_event' ? 'replay' : eventType ) satisfies DataCategory ;
786796
787- return this . _prepareEvent ( event , hint , currentScope , capturedSpanIsolationScope )
797+ return this . _prepareEvent ( event , hint , currentScope , isolationScope )
788798 . then ( prepared => {
789799 if ( prepared === null ) {
790800 this . recordDroppedEvent ( 'event_processor' , dataCategory , event ) ;
@@ -811,7 +821,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
811821 throw new SentryError ( `${ beforeSendLabel } returned \`null\`, will not send event.` , 'log' ) ;
812822 }
813823
814- const session = currentScope && currentScope . getSession ( ) ;
824+ const session = currentScope . getSession ( ) || isolationScope . getSession ( ) ;
815825 if ( ! isTransaction && session ) {
816826 this . _updateSessionFromEvent ( session , processedEvent ) ;
817827 }
0 commit comments