diff --git a/js/helper.js b/js/helper.js index 2da28910ac..a4a7a61f0e 100644 --- a/js/helper.js +++ b/js/helper.js @@ -170,9 +170,6 @@ async function execute(args, live, silent, configFile, config = {}) { if (config.vcsRemote) { env.SENTRY_VCS_REMOTE = config.vcsRemote; } - if (config.forceArtifactBundles) { - env.SENTRY_FORCE_ARTIFACT_BUNDLES = config.forceArtifactBundles; - } if (config.customHeader) { env.CUSTOM_HEADER = config.customHeader; } else if (config.headers) { diff --git a/js/index.d.ts b/js/index.d.ts index d59bf8a0d3..320f2fbac4 100644 --- a/js/index.d.ts +++ b/js/index.d.ts @@ -42,12 +42,6 @@ declare module '@sentry/cli' { * If true, all logs are suppressed. */ silent?: boolean; - /** - * Whether to use the debug ID method of uploading source maps. - * This value will update `SENTRY_FORCE_ARTIFACT_BUNDLES` env variable. - * @experimental - */ - forceArtifactBundles?: string; /** * A header added to every outgoing network request. * This value will update `CUSTOM_HEADER` env variable. @@ -129,6 +123,10 @@ declare module '@sentry/cli' { * Usually your build number. */ dist?: string; + /** + * Use new Artifact Bundles upload, that enables use of Debug ID for Source Maps discovery. + */ + useDebugIds?: boolean; } export interface SentryCliNewDeployOptions { diff --git a/js/releases/options/uploadSourcemaps.js b/js/releases/options/uploadSourcemaps.js index cbd40aeaed..1953871c94 100644 --- a/js/releases/options/uploadSourcemaps.js +++ b/js/releases/options/uploadSourcemaps.js @@ -48,4 +48,8 @@ module.exports = { param: '--ext', type: 'array', }, + useDebugIds: { + param: '--use-debug-ids', + type: 'boolean', + }, }; diff --git a/src/api.rs b/src/api.rs index 4778186258..e9eb95d0b4 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1125,15 +1125,7 @@ impl Api { .get(&url)? .convert_rnf::(ApiErrorKind::ChunkUploadNotSupported) { - Ok(mut options) => { - // TODO: remove this logic after we can trust the server responses - if !options.supports(ChunkUploadCapability::ArtifactBundles) - && env::var("SENTRY_FORCE_ARTIFACT_BUNDLES").ok().as_deref() == Some("1") - { - options.accept.push(ChunkUploadCapability::ArtifactBundles); - } - Ok(Some(options)) - } + Ok(options) => Ok(Some(options)), Err(error) => { if error.kind() == ApiErrorKind::ChunkUploadNotSupported { Ok(None) diff --git a/src/commands/sourcemaps/upload.rs b/src/commands/sourcemaps/upload.rs index a9f7f90354..da12c9660b 100644 --- a/src/commands/sourcemaps/upload.rs +++ b/src/commands/sourcemaps/upload.rs @@ -6,7 +6,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; use glob::{glob_with, MatchOptions}; use log::{debug, warn}; -use crate::api::Api; +use crate::api::{Api, ChunkUploadCapability}; use crate::config::Config; use crate::utils::args::validate_distribution; use crate::utils::file_search::ReleaseFileSearch; @@ -180,6 +180,17 @@ pub fn make_command(command: Command) -> Command { Defaults to: `--ext=js --ext=map --ext=jsbundle --ext=bundle`", ), ) + // NOTE: Hidden until we decide to expose it publicly + .arg( + Arg::new("use_debug_ids") + .long("use-debug-ids") + .action(ArgAction::SetTrue) + .help( + "Use new Artifact Bundles upload, that enables the use of Debug IDs \ + for Source Maps discovery.", + ) + .hide(true), + ) // Legacy flag that has no effect, left hidden for backward compatibility .arg( Arg::new("rewrite") @@ -195,17 +206,6 @@ pub fn make_command(command: Command) -> Command { .short('v') .hide(true), ) - // NOTE: Hidden until we decide to expose it publicly - .arg( - Arg::new("no_inject") - .long("no-inject") - .action(ArgAction::SetTrue) - .help( - "Skip injection of debug ids into source files \ - and sourcemaps prior to uploading.", - ) - .hide(true), - ) } fn get_prefixes_from_args(matches: &ArgMatches) -> Vec<&str> { @@ -353,12 +353,6 @@ fn process_sources_from_paths( } } - if env::var("SENTRY_FORCE_ARTIFACT_BUNDLES").ok().as_deref() == Some("1") - && !matches.get_flag("no_inject") - { - processor.inject_debug_ids(false)?; - } - if !matches.get_flag("no_rewrite") { let prefixes = get_prefixes_from_args(matches); processor.rewrite(&prefixes)?; @@ -381,7 +375,17 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { let (org, project) = config.get_org_and_project(matches)?; let api = Api::current(); let mut processor = SourceMapProcessor::new(); - let chunk_upload_options = api.get_chunk_upload_options(&org)?; + let mut chunk_upload_options = api.get_chunk_upload_options(&org)?; + + if matches.get_flag("use_debug_ids") + || env::var("SENTRY_FORCE_ARTIFACT_BUNDLES").ok().as_deref() == Some("1") + { + if let Some(ref mut options) = chunk_upload_options { + if !options.supports(ChunkUploadCapability::ArtifactBundles) { + options.accept.push(ChunkUploadCapability::ArtifactBundles); + } + } + } if matches.contains_id("bundle") && matches.contains_id("bundle_sourcemap") { process_sources_from_bundle(matches, &mut processor)?;