Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't uninstall or upgrade Sentry CLI if install folder contains package.json, even if not managed by npm/yarn #2174

Open
1 of 8 tasks
jasondentler opened this issue Oct 1, 2024 · 1 comment
Labels

Comments

@jasondentler
Copy link

CLI Version

2.36.2

Operating System and Architecture

  • macOS (arm64)
  • macOS (x86_64)
  • Linux (i686)
  • Linux (x86_64)
  • Linux (armv7)
  • Linux (aarch64)
  • Windows (i686)
  • Windows (x86_64)

Operating System Version

macOS Sonoma 14.6.1 (23G93)

Link to reproduction repository

No response

CLI Command

./sentry-cli uninstall

Exact Reproduction Steps

Checkout your app's source code, as you would on a CI server such as Jenkins
Install sentry to the current directory using the install script hosted at https://sentry.io/get-cli/
Attempt to uninstall or upgrade sentry-cli using ./sentry-cli update or ./sentry-cli uninstall

touch package.json
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR="." SENTRY_CLI_VERSION="2.36.2" bash
./sentry-cli update
./sentry-cli uninstall

Expected Results

The upgrade or uninstall command succeeds, since sentry-cli is not mentioned anywhere in package.json.

Actual Results

Upgrade and uninstall fail with the following message:

Please use npm/yarn to update sentry-cli, using one of the following commands:
  yarn upgrade @sentry/cli
  yarn global upgrade @sentry/cli
  npm update @sentry/cli
  npm update -g @sentry/cli

This line checks for the existence of package.json, without checking if sentry-cli is actually included in the file:

Ok(exe.is_file())

Logs

me@XXX xxx % touch package.json

me@XXX xxx % curl -sL https://sentry.io/get-cli/ | INSTALL_DIR="." SENTRY_CLI_VERSION="2.36.2" bash

This script will automatically install sentry-cli (2.36.2) for you.
Installation path: ./sentry-cli
######################################################################## 100.0%
Sucessfully installed sentry-cli 2.36.2
Done!
me@XXX xxx % ./sentry-cli update --log-level=debug

  DEBUG   2024-10-01 09:50:04.045278 -05:00 sentry-cli version: 2.36.2, platform: "darwin", architecture: "arm64"
  INFO    2024-10-01 09:50:04.047210 -05:00 sentry-cli was invoked with the following command line: "./sentry-cli" "update" "--log-level=debug"
This installation of sentry-cli is managed through npm/yarn
Please use npm/yarn to update sentry-cli, using one of the following commands:
  yarn upgrade @sentry/cli
  yarn global upgrade @sentry/cli
  npm update @sentry/cli
  npm update -g @sentry/cli
me@XXX xxx % ./sentry-cli uninstall --log-level=debug

  DEBUG   2024-10-01 09:50:16.544956 -05:00 sentry-cli version: 2.36.2, platform: "darwin", architecture: "arm64"
  INFO    2024-10-01 09:50:16.545831 -05:00 sentry-cli was invoked with the following command line: "./sentry-cli" "uninstall" "--log-level=debug"
This installation of sentry-cli is managed through npm/yarn
Please use npm/yarn to uninstall sentry-cli, using one of the following commands:
  yarn remove @sentry/cli
  yarn global remove @sentry/cli
  npm uninstall @sentry/cli
  npm uninstall --global @sentry/cli
@szokeasaurusrex
Copy link
Member

@jasondentler thanks for reporting this bug! Probably the most reliable way to fix this would be to distribute a different binary (e.g. using the managed feature) to npm so that we don't have to guess at runtime how the Sentry CLI was installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants