File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed
Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ function stringToArrayHeaders(requestHeaders: string): string[] {
9797 }
9898 const key = header . slice ( 0 , colonIndex ) . trim ( ) ;
9999 const value = header . slice ( colonIndex + 1 ) . trim ( ) ;
100- if ( key != null && value != null ) {
100+ if ( key && value ) {
101101 headers . push ( key , value ) ;
102102 }
103103 } catch { }
Original file line number Diff line number Diff line change @@ -112,7 +112,6 @@ export function addTracePropagationHeadersToOutgoingRequest(
112112 cleanedExistingBaggage = objectToBaggageHeader ( baggageWithoutSentry ) ;
113113 }
114114
115- // If a sentry-trace header was already added, we don't add our baggage at all.
116115 const newBaggage = mergeBaggageHeaders ( cleanedExistingBaggage , baggage ) ;
117116 if ( newBaggage ) {
118117 try {
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ export class SentryPropagator extends W3CBaggagePropagator {
7575 if ( baggageEntries ) {
7676 Object . entries ( baggageEntries ) . forEach ( ( [ key , value ] ) => {
7777 if ( ! existingSentryTraceHeader && key . startsWith ( SENTRY_BAGGAGE_KEY_PREFIX ) ) {
78+ // Edge case: A baggage header with sentry- keys was added previously but no
79+ // sentry-trace header. In this case we remove the old sentry-keys and add new
80+ // ones below.
7881 return ;
7982 }
8083 baggage = baggage . setEntry ( key , { value } ) ;
You can’t perform that action at this time.
0 commit comments