Skip to content

Commit e9436cd

Browse files
fix(sourcemaps): Fix incorrect chunk upload not supported error (#2931)
### Description Supplying a non-existent organization to the `sentry-cli sourcemaps upload` can cause an error, which states "This version of Sentry does not support artifact bundles ...", even though this is not true. The reason is that the endpoint to get the chunk upload options contains the organization, and if a non-existent organization is supplied, we get a 404 error. Here, we fix the error message to indicate that an incorrect organization is the most likely explanation, while acknowledging that lacking support for artifact bundles could also cause the problem. ### Issues - Resolves #2820 - Resolves [CLI-176](https://linear.app/getsentry/issue/CLI-176/non-existent-org-causes-chunk-upload-not-supported-error)
1 parent ccab0d7 commit e9436cd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Fixes
1010

1111
- Skip setting `base_sha` and `base_ref` when they equal `head_sha` during auto-inference, since comparing a commit to itself provides no meaningful baseline ([#2924](https://github.com/getsentry/sentry-cli/pull/2924)).
12+
- Improved error message when supplying a non-existent organization to `sentry-cli sourcemaps upload`. The error now correctly indicates the organization doesn't exist, rather than incorrectly suggesting the Sentry server lacks artifact bundle support ([#2931](https://github.com/getsentry/sentry-cli/pull/2931)).
1213

1314
## 2.58.0
1415

src/utils/file_upload.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,19 @@ pub fn initialize_legacy_release_upload(context: &UploadContext) -> Result<()> {
7575
..Default::default()
7676
},
7777
)?;
78-
} else {
78+
} else if context.chunk_upload_options.is_some() {
7979
bail!("This version of Sentry does not support artifact bundles. A release slug is required (provide with --release or by setting the SENTRY_RELEASE environment variable)");
80+
} else {
81+
// We got a 404 when trying to get the chunk options from the server. Most likely, the
82+
// organization does not exist, though old self-hosted Sentry servers may also completely
83+
// lack support for chunked uploads.
84+
bail!(
85+
"The provided organization \"{}\" does not exist. If you are using a self-hosted \
86+
Sentry server, it is also possible that your Sentry server lacks support for \
87+
uploading artifact bundles, in which case you need to provide a release slug with \
88+
--release or by setting the SENTRY_RELEASE environment variable.",
89+
context.org
90+
);
8091
}
8192
Ok(())
8293
}

0 commit comments

Comments
 (0)