@@ -2,10 +2,9 @@ import SentryCli from "@sentry/cli";
22import {
33 closeSession ,
44 DEFAULT_ENVIRONMENT ,
5- getDynamicSamplingContextFromSpan ,
5+ getTraceData ,
66 makeSession ,
77 setMeasurement ,
8- spanToTraceHeader ,
98 startSpan ,
109} from "@sentry/core" ;
1110import * as dotenv from "dotenv" ;
@@ -23,7 +22,6 @@ import { Options, SentrySDKBuildFlags } from "./types";
2322import { arrayify , getTurborepoEnvPassthroughWarning , stripQueryAndHashFromPath } from "./utils" ;
2423import { glob } from "glob" ;
2524import { defaultRewriteSourcesHook , prepareBundleForDebugIdUpload } from "./debug-id-upload" ;
26- import { dynamicSamplingContextToSentryBaggageHeader } from "@sentry/utils" ;
2725
2826export type SentryBuildPluginManager = {
2927 /**
@@ -89,10 +87,7 @@ export type SentryBuildPluginManager = {
8987 createDependencyOnBuildArtifacts : ( ) => ( ) => void ;
9088} ;
9189
92- function createCliInstance (
93- options : NormalizedOptions ,
94- additionalHeaders : Record < string , string > = { }
95- ) : SentryCli {
90+ function createCliInstance ( options : NormalizedOptions ) : SentryCli {
9691 return new SentryCli ( null , {
9792 authToken : options . authToken ,
9893 org : options . org ,
@@ -101,8 +96,7 @@ function createCliInstance(
10196 url : options . url ,
10297 vcsRemote : options . release . vcsRemote ,
10398 headers : {
104- ...options . headers ,
105- ...additionalHeaders ,
99+ ...getTraceData ( ) ,
106100 } ,
107101 } ) ;
108102}
@@ -666,14 +660,8 @@ export function createSentryBuildPluginManager(
666660 setMeasurement ( "files" , files . length , "none" , prepBundlesSpan ) ;
667661 setMeasurement ( "upload_size" , uploadSize , "byte" , prepBundlesSpan ) ;
668662
669- await startSpan ( { name : "upload" , scope : sentryScope } , async ( uploadSpan ) => {
670- const cliInstance = createCliInstance ( options , {
671- "sentry-trace" : spanToTraceHeader ( uploadSpan ) ,
672- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
673- baggage : dynamicSamplingContextToSentryBaggageHeader (
674- getDynamicSamplingContextFromSpan ( uploadSpan )
675- ) ! ,
676- } ) ;
663+ await startSpan ( { name : "upload" , scope : sentryScope } , async ( ) => {
664+ const cliInstance = createCliInstance ( options ) ;
677665
678666 await cliInstance . releases . uploadSourceMaps (
679667 options . release . name ?? "undefined" , // unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
0 commit comments