Sonarqube is missing the Authorization token for Bitbucket DC

Must-share information (formatted with Markdown):

  • SonarQube 9.9.7
  • SonarQube deployed from zip
  • what are you trying to achieve
    Setting up DevOps Platform Integrations with Bitbucket DC
    Sonarqube received 401 from Bitbucket. (Bitbucket logs the 401 in the access log)
    Curl is working:
    curl -H "Authorization: Bearer <token>" https://192.168.4.145/re st/api/1.0/repos
  • what have you tried so far to achieve this
    Started nc -kl 8080 to debug headers und connected Sonarqube to it.
    The Request received is missing the auth tocken:
GET /rest/api/1.0/repos HTTP/1.1
x-atlassian-token: no-check
Accept: application/json
Host: <ip>:8080
Connection: Keep-Alive
User-Agent: okhttp/4.10.0

Using Curl (was working):

GET /rest/api/1.0/repos HTTP/1.1
Host: <ip>:8080
User-Agent: curl/7.88.1
Accept: */*
Authorization: Bearer <token>

Hi,

You haven’t mentioned whether you’re using Bitbucket Server or Bitbucket Cloud, but the docs should help.

 
Ann

Hi Ann,

It is a Bitbucket DC (Server with Data Center Licence) and configured according to the docs but the configured API Key isn’t sent by the Sonarqube Server

Ruby

Hi Ruby,

How have you confirmed this? Via logs? Packet tracing?

 
Ann

As I mention this in the first post, I opened a Socket with nc -kl 8080 and changed the URL in Sonarqube to send its requests there.
nc logs all received headers.
Curl has the required Authorization header, Sonarqube didn’t.

Hi,

Under what circumstances was this 401 received? What shows up in your server logs?

 
Thx,
Ann

@Ruby_Paasche What version of Bitbucket Data Center are you using? I’m wondering if it’s the same issue described in this post. If so, I believe this issue can be a simple one line change to the endpoint SonarQube uses to test the provided Bitbucket URL.

2 Likes

Thanks yes it is the exact same issue.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.