getsentry / sentry-cli

A command line utility to work with Sentry.
https://docs.sentry.io/cli/
BSD 3-Clause "New" or "Revised" License
898 stars 221 forks source link

no_proxy environment variable not honored #2090

Open mrewak opened 3 months ago

mrewak commented 3 months ago

CLI Version

2.32.1

Operating System and Architecture

Operating System Version

MacOS, Amazon Linux 2

Link to reproduction repository

No response

CLI Command

sentry-cli sourcemaps upload ./dist

Exact Reproduction Steps

  1. Set SENTRY_LOG_LEVEL=debug
  2. Set http_proxy environment variable to some not existing host for the test
  3. Add valid sentry host to no_proxy environment variable
  4. Upload sourcemaps using cli: sentry-cli sourcemaps upload ./dist
  5. Error would happen, debug logs should show network traffic wants to go throgh proxy event sentry host domain is specified in no_proxy

Expected Results

sentry-cli should upload sourcemaps not using proxy if sentry host domain is in 'no_proxy' env var.

Actual Results

Network error 403 from my proxy config although sentry-cli shouldn't use the proxy

Logs

Error: Command failed: [/builds/web-app/node_modules]/@sentry/cli-linux-x64/bin/sentry-cli releases new 56b1aa4cad0f7727793ffbef6311c7284be98459 DEBUG 2024-06-17 16:43:01.492731527 +00:00 sentry-cli version: 2.32.1, platform: "linux", architecture: "x86_64" INFO 2024-06-17 16:43:01.492802432 +00:00 sentry-cli was invoked with the following command line: "/builds/web-app/node_modules/@sentry/cli-linux-x64/bin/sentry-cli" "releases" "new" "56b1aa4cad0f7727793ffbef6311c7284be98459" DEBUG 2024-06-17 16:43:01.493614954 +00:00 request POST https://sentry.masked-domain.com/api/0/projects/sentry/app-web/releases/ DEBUG 2024-06-17 16:43:01.493635657 +00:00 pipeline: webpack-plugin/2.18.0 DEBUG 2024-06-17 16:43:01.493645150 +00:00 using token authentication DEBUG 2024-06-17 16:43:01.493666540 +00:00 json body: {"version":"56b1aa4cad0f7727793ffbef6311c7284be98459","projects":["web-app"],"dateStarted":"2024-06-17T16:43:01.493582344Z"} DEBUG 2024-06-17 16:43:01.493676827 +00:00 retry number 0, max retries: 0 DEBUG 2024-06-17 16:43:01.508866627 +00:00 > CONNECT sentry.masked-domain.com:443 HTTP/1.1 DEBUG 2024-06-17 16:43:01.508995258 +00:00 > Host: sentry.masked-domain.com:443 DEBUG 2024-06-17 16:43:01.509011161 +00:00 > Proxy-Connection: Keep-Alive DEBUG 2024-06-17 16:43:01.509131635 +00:00 < HTTP/1.1 403 Forbidden DEBUG 2024-06-17 16:43:01.509190744 +00:00 < Date: Mon, 17 Jun 2024 16:43:01 GMT DEBUG 2024-06-17 16:43:01.509225304 +00:00 < Content-Length: 0 error: API request failed caused by: [56] Failure when receiving data from the peer (Received HTTP code 403 from proxy after CONNECT) DEBUG 2024-06-17 16:43:01.509463118 +00:00 skipping update nagger because session is not attended

szokeasaurusrex commented 3 months ago

Hi @mrewak, thank you for the suggestion; I think this is a feature we can add support for via our Curl library.

I will place this issue on our backlog. In the meantime, we welcome community PRs, so if you would like to create a PR to add this feature, please feel free.