Bundler plugin says upload successful, when Sentry CLI fails
This issue was originally reported by @kubijo in the Sentry CLI repository.
This issue report is based on the information provided in the original issue; I did not try to reproduce the bug myself.
@kubijo, it would be helpful if you could fill in any missing information here, such as the version of the bundler plugin you are using, and any reproduction steps which are missing.
Environment
"@sentry/webpack-plugin": "3.1.1", with Sentry CLI 2.39.1. Running on Ubuntu 24.10.
Steps to Reproduce
- Use the bundler plugin to upload sourcemaps to Sentry
- When uploading, configure a non-existing project as the destination, so that Sentry CLI fails during the upload.
- In the original issue, the Sentry CLI failed due to a 502 error. However, triggering any kind of failure in the Sentry CLI should likely cause the same behavior in the bundler plugin.
Expected Result
Bundler plugin logs that an error prevented upload.
Actual Result
Bundler plugin logs that sourcemap upload was successful:
[...]
> Bundled 42 files for upload
> Bundle ID: 95362a95-0674-5519-ad70-4fc1c6bb1d63
error: Project not found. Ensure that you configured the correct project and organization.
[...]
[sentry-webpack-plugin] Info: Successfully uploaded source maps to Sentry
"@sentry/webpack-plugin": "3.1.1",
For some more annoyances...
- even though I supplied
{ debug: true }flag in plugin options, it printsAdd --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.on error and I do certainly miss a lot of logging ... you likely do not propagate that to CLI - you depend on an old CLI here, can you keep it up to date?
@kubijo we like to keep our issues limited in scope. So, please open a separate issue for the first item you have mentioned.
@lforst has already bumped the Sentry CLI dependency to the latest version in #671. I believe he is planning to release a new version of the bundler plugin today.
I am observing the same issue in @sentry/esbuild-plugin v3.2.2
Example output snippet:
error: API request failed
Caused by:
sentry reported an error: Invalid token (http status: 401)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.
[sentry-esbuild-plugin] Info: Successfully uploaded source maps to Sentry
The culprit is the log statement here.
@jakeoeding do you have a .env.sentry-build-plugin file that has a valid auth token in it? Are you otherwise supplying the auth token somewhere? Your issue is slightly different (tho it should not report a successful upload either).
That specific error was because I didn't correctly supply the url option, but that's besides the point.
I just wanted to point out that issue reported above is not limited to @sentry/webpack-plugin.
There's also a "bug" in @sentry/cli that makes erroneuos Sentry CLI upload commands appear successful and hence let the success message be printed wrongfully (https://github.com/getsentry/sentry-cli/issues/2062). I'll fix this in the CLI's JS interface but #757 should also contribute to reducing the number of false success messages.
Unfortunately, we need to keep this open until https://github.com/getsentry/sentry-cli/issues/2062 is fixed and we updated the CLI version in the plugins