sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

API request failed caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

Open MessyComposer opened this issue 1 year ago • 7 comments

CLI Version

2.36.1

Operating System and Architecture

  • [ ] macOS (arm64)
  • [ ] macOS (x86_64)
  • [ ] Linux (i686)
  • [x] Linux (x86_64)
  • [ ] Linux (armv7)
  • [ ] Linux (aarch64)
  • [ ] Windows (i686)
  • [ ] Windows (x86_64)

Operating System Version

node:18

Link to reproduction repository

No response

CLI Command

sentry-cli sourcemaps upload ./build --log-level=debug

Exact Reproduction Steps

We're running docker in docker (CI/CD runners), and the sourcemap upload fails when using sentry cli 2.36.1

#18 271.0   DEBUG   2024-10-08 04:59:31.639983941 +00:00 sentry-cli version: 2.36.1, platform: "linux", architecture: "x86_64"
#18 271.0   INFO    2024-10-08 04:59:31.642626745 +00:00 sentry-cli was invoked with the following command line: "/node_modules/@sentry/cli-linux-x64/bin/sentry-cli" "sourcemaps" "upload" "./build" "--log-level=debug"
#18 271.0   DEBUG   2024-10-08 04:59:31.665596764 +00:00 request GET https://sentry.io/api/0/organizations/my-org/chunk-upload/
#18 271.0   DEBUG   2024-10-08 04:59:31.666097469 +00:00 using token authentication
#18 271.0   DEBUG   2024-10-08 04:59:31.666149118 +00:00 retry number 0, max retries: 0
#18 271.0 error: API request failed
#18 271.0   caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

There is nothing of real value in the logs that I can tell, it just instantly fails with Could not resolve host: sentry.io

Downgrading to 2.21.2 and it works fine.

#17 255.6   DEBUG   2024-10-08 05:26:01.509355690 +00:00 sentry-cli version: 2.21.2, platform: "linux", architecture: "x86_64"
#17 255.6   INFO    2024-10-08 05:26:01.509490578 +00:00 sentry-cli was invoked with the following command line: "/node_modules/@sentry/cli/sentry-cli" "sourcemaps" "upload" "./build" "--log-level=debug"
#17 255.9   DEBUG   2024-10-08 05:26:01.733801645 +00:00 request GET https://sentry.io/api/0/organizations/my-org/chunk-upload/
#17 255.9   DEBUG   2024-10-08 05:26:01.733921544 +00:00 using token authentication
#17 255.9   DEBUG   2024-10-08 05:26:01.775845651 +00:00 retry number 0, max retries: 0
#17 256.1   DEBUG   2024-10-08 05:26:01.957978594 +00:00 > GET /api/0/organizations/my-org/chunk-upload/ HTTP/1.1
#17 256.1   DEBUG   2024-10-08 05:26:01.958671628 +00:00 > Host: sentry.io
#17 256.1   DEBUG   2024-10-08 05:26:01.958781797 +00:00 > Accept: */*
...
#17 261.9 > Uploaded files to Sentry
#17 262.2 > File upload complete (processing pending on server)

Expected Results

The sourcemaps files are uploaded to sentry successfully

Actual Results

API request failed caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

Logs

#18 271.0   DEBUG   2024-10-08 04:59:31.639983941 +00:00 sentry-cli version: 2.36.1, platform: "linux", architecture: "x86_64"
#18 271.0   INFO    2024-10-08 04:59:31.642626745 +00:00 sentry-cli was invoked with the following command line: "/node_modules/@sentry/cli-linux-x64/bin/sentry-cli" "sourcemaps" "upload" "./build" "--log-level=debug"
#18 271.0   DEBUG   2024-10-08 04:59:31.665596764 +00:00 request GET https://sentry.io/api/0/organizations/my-org/chunk-upload/
#18 271.0   DEBUG   2024-10-08 04:59:31.666097469 +00:00 using token authentication
#18 271.0   DEBUG   2024-10-08 04:59:31.666149118 +00:00 retry number 0, max retries: 0
#18 271.0 error: API request failed
#18 271.0   caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

MessyComposer avatar Oct 08 '24 05:10 MessyComposer

@MessyComposer could you please try upgrading to the latest Sentry CLI version? We upgraded our curl-sys dependency in 2.36.3 to fix a similar error (#2155); perhaps the dependency bump also fixes the problem you are experiencing.

If upgrading does not help, I would also suggest checking your network connection and network settings; this error might be caused by some kind of connection problem or network misconfiguration.

szokeasaurusrex avatar Oct 08 '24 07:10 szokeasaurusrex

Just got around to trying it again with the latest cli version 2.37.0 and it still results in the same error Could not resolve hostname (Could not resolve host: sentry.io) (I should add that debug adds no insight what so ever, and the error is thrown right away, ie. it does not even try to connect to sentry.io)

It is not a networking related issue, seeing how 2.21.2 works flawlessly. It seems there's some change in the cli which breaks source map uploads when using DinD

Guess I'll be forced to stay on 2.21.2 for the time being...

MessyComposer avatar Oct 21 '24 06:10 MessyComposer

@MessyComposer does the error occur on every run, or is it a transient failure?

szokeasaurusrex avatar Oct 21 '24 07:10 szokeasaurusrex

Also, are you running in rootless Docker? if yes, this might be a duplicate of https://github.com/getsentry/sentry-cli/issues/1929

szokeasaurusrex avatar Oct 21 '24 07:10 szokeasaurusrex

Yes, occurs on every run and not running in rootless docker

MessyComposer avatar Oct 21 '24 10:10 MessyComposer

Okay, thanks for the information @MessyComposer. One more clarification:

It seems there's some change in the cli which breaks source map uploads when using DinD

By "DinD" are you referring to Docker in Docker?

szokeasaurusrex avatar Oct 22 '24 08:10 szokeasaurusrex

By "DinD" are you referring to Docker in Docker?

Yep

MessyComposer avatar Oct 23 '24 12:10 MessyComposer

@MessyComposer – finally got around to taking another look at this. Are you still experiencing problems here?

If so, how exactly are you installing Sentry CLI? Are you using the official Sentry CLI Docker Container?

szokeasaurusrex avatar Mar 03 '25 10:03 szokeasaurusrex

I also ran some tests for this issue, as I had the same problem. I tested randomly picked versions.

curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.42.3 bash
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.42.2 bash
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.38.2 bash
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.36.0 bash

produced:

ubuntu@d0f411f3d02b:/docker$ sentry-cli projects --org my_org list
error: API request failed
  caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

I also tested older versions:

curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.31.1 bash
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.29.0 bash
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.25.1 bash

and they produced:

sentry-cli projects --org my_org list
  WARN    2025-03-13 13:30:47.252348077 +00:00 Unrecognized auth token format!
  Hint: Did you copy your token correctly?
error: API request failed
  caused by: [6] Couldn't resolve host name (Could not resolve host: sentry.io)

The first working version for me was also 2.21.2.

curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.21.2 bash

PatNowak avatar Mar 13 '25 13:03 PatNowak

Thanks for testing @PatNowak! Are you also running sentry-cli within a docker in docker setup as @MessyComposer reported?

lcian avatar Mar 13 '25 14:03 lcian

Thanks for testing @PatNowak! Are you also running sentry-cli within a docker in docker setup as @MessyComposer reported?

I use my own setup, but it's just a docker image based on ubuntu:

ubuntu@d0f411f3d02b:/docker$ lsb_release -a 
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

I install sentry-cli just like I tested above.

PatNowak avatar Mar 13 '25 14:03 PatNowak

Thanks @PatNowak for the useful context. It will probably help us test this with an easier setup.

lcian avatar Mar 13 '25 15:03 lcian

@PatNowak, sorry, but I cannot reproduce this error on the official Ubuntu Docker image. Could you perhaps provide the Dockerfile for the container you are using (or a link to the container image)?

We would recommend using the official Sentry CLI Docker Container if you need to use Sentry CLI in Docker. Is there any reason you cannot use it?

szokeasaurusrex avatar Mar 17 '25 15:03 szokeasaurusrex

Hi @MessyComposer and @PatNowak – since we are still missing the information we would need to be able to reproduce this problem, and since this issue has been inactive for over a week, we will close this issue for now.

If you are still experiencing this problem and are able to provide a full reproduction, please reach out again by opening a new issue referencing this one.

szokeasaurusrex avatar Mar 24 '25 08:03 szokeasaurusrex