502 (Generic error) when publishing release using Sentry-CLI


#1

Possibly related to https://github.com/getsentry/sentry-cli/issues/41 and Http error: generic error (502)

When uploading sourcemaps to our privately hosted Sentry instance (Docker, Sentry 8.22) senty-cli often received 502 (Generic error) responses.

We are hosting Sentry behind a reverse proxy, as suggested here:


(I also disabled the keep-alives in Sentry CLI, as suggested later in the thread)

The response being returned from the reverse proxy is either a 502.3 or a 502.6, as we are using IIS as a reverse proxy, we also receive a win32 status code in the IIS log file, which is: 12152 : ERROR_HTTP_INVALID_SERVER_RESPONSE

The actual html responded by the server is also displayed in the sentry-cli output (as it is in info or debug mode), but this is a generic error message by IIS:

502 - Web server received an invalid response while acting as a gateway or proxy server.

Server Error

502 - Web server received an invalid response while acting as a gateway or proxy server.

There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

Is there any way I can look into the Sentry server logs themselves to analyze this problem?
Just to be clear: this upload does intermittently succeed.


#2

Example failing request (POST), retrieved from reverse proxy IIS log file:

Reverse proxy response to Docker CLI

2018-06-19 07:38:02 W3SVC28 REVERSEPROXYSERVERNAME SERVERIP POST /api/0/projects/myorg/myproj/releases/1.1.4-sourcemap-test-461/files/ - 443 - CLIENTIP HTTP/1.1 sentry-cli/1.29.1 - - sentryondocker:8080 201 0 0 709 97086 421
2018-06-19 07:38:02 W3SVC28 REVERSEPROXYSERVERNAME SERVERIP POST /api/0/projects/myorg/myproj/releases/1.1.4-sourcemap-test-461/files/ - 443 - CLIENTIP HTTP/1.1 sentry-cli/1.29.1 - - sentryondocker:8080 502 3 12152 5173 7433 0

2nd POST is failing
502.3 (12152) indicates:

ERROR_HTTP_INVALID_SERVER_RESPONSE
The server response could not be parsed.
https://support.microsoft.com/en-us/help/193625/info-wininet-error-codes-12001-through-12156

After logging Sentry output using:
docker logs -f -t --since 3600m sentry 2> d:\sentry\logs\log.txt

Docker response to Reverse proxy:

2018-06-19T07:38:02.253042500Z IPADDRESSHERE - - [19/Jun/2018:07:38:01 +0000] "POST /api/0/projects/myorg/myproj/releases/1.1.4-sourcemap-test-461/files/ HTTP/1.1" 201 498 "-" "sentry-cli/1.29.1"
2018-06-19T07:38:02.681132200Z IPADDRESSHERE - - [19/Jun/2018:07:38:02 +0000] "POST /api/0/projects/myorg/myproj/releases/1.1.4-sourcemap-test-461/files/ HTTP/1.1" 201 496 "-" "sentry-cli/1.29.1"

2nd response indicates 201 (created) but results in failure when it reached the reverse proxy, the only apparent difference is the column after the response code.
Is it possible this could be the size (496 bytes instead of 498) and that the response is missing something like EOF?

I would like to find a way to actually capture the response from Sentry to see what is actually returned.