bitrise-steplib / steps-gitlab-status

MIT License
4 stars 15 forks source link

The provided content-type '' is not supported. #28

Closed odemolliens closed 3 years ago

odemolliens commented 3 years ago

Troubleshooting

Useful information

Issue description

Without any change in our bitrise configuration or in the YAML, this step stopped working with always the same error: {"error":"The provided content-type '' is not supported."}

I tested the same call with cURL (by using same parameters) and it's working fine.

I have added some extra logs to debug the call and then we can see:

POST /api/v4/projects/xxx/statuses/xxx HTTP/1.1
Host: gitlab.com
User-Agent: Go-http-client/1.1
Content-Length: 211
Accept-Encoding: gzip

context=xxx&coverage=0.000000&description=xxx&ref=xxx&state=running&target_url=xxx
HTTP/2.0 415 Unsupported Media Type
Content-Length: 58
Cache-Control: no-cache
Cf-Cache-Status: DYNAMIC
Cf-Ray: xxx-LAX
Cf-Request-Id: xxx
Content-Type: application/json
Date: Wed, 28 Apr 2021 11:46:41 GMT
Expect-Ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"

{"error":"The provided content-type '' is not supported."}

Bitrise info

+------------------------------------------------------------------------------+
| (0) xxxx                                |
+------------------------------------------------------------------------------+
| id: gitlab-status                                                            |
| version: 0.12.1                                                              |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2021-04-28T12:31:29+01:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
Config:
- PrivateToken: xxx
- RepositoryURL: git@gitlab.com:xxxx
- GitRef: xxx
- CommitHash: xxx
- APIURL: https://gitlab.com/api/v4
- Status: running
- TargetURL: https://app.bitrise.io/build/7ca107ab3b691a3f
- Context: xxx
- Description: xxx
- Coverage: 0
Error: server error: 415 Unsupported Media Type url: https://gitlab.com/api/v4/projects/xxx/statuses/xxx code: 415 body: {"error":"The provided content-type '' is not supported."}

  

Steps to reproduce

  1. Using the step as before (not linked to the new release; issue in on 0.12.1 too)
  2. Step is failing
odemolliens commented 3 years ago

Hello @sylank! any news regarding this issue? (Opened 7 days ago..)

sylank commented 3 years ago

Hello, @odemolliens,

In my last PR I have updated the dependencies and moved the project to gomod. It was a chore and a bugfix PR.

I think Go has changed something in the standard HTTP library because the Content-Type header field is not included in the request by default. We have faced this issue in internal service-to-service communication.

I have just fixed the issue and I am testing it locally. I will send a PR as of today.

Thank you for the issue report. Our testing workflow went through this "bug" so I need to fix it on this repo as well.

sylank commented 3 years ago

@odemolliens, I merged and released the patch, could you validate the fix? It will be available under the 0.12.6 step version.

BTW: I checked our test workflow too and it was green (and the step operated well) in April. I started a test workflow on the master branch and it failed with the issue that you mentioned in this issue report. SOO I think GitLab changed something in the API during the time 😺 .

odemolliens commented 3 years ago
Capture d’écran 2021-05-09 à 18 04 39

Issue fixed 👍