Failed to create Bitbucket Cloud Quality Report - link is not a valid URL

Hello,

Setup:

  • SonarQube Developer Edition Version 8.7 (build 41497), Bitbucket Cloud
  • Analysis running via Bamboo using dotnet-sonarscanner 5.0.4
  • SonarScanner running against .NET project, everything else working in Sonar UI (project key, pr key etc)
  • I’m trying to get pull request decoration working

I’ve configured PR handling in Sonar successfully and trying out the new Bitbucket Cloud integration. The analysis status shows up in Bitbucket Cloud PR summary, but the decoration itself fails.

image

Message in Sonar UI’s PR analysis warnings dialog (second one is about using deprecated sonar.exclusions):

Failed to create Bitbucket Cloud Quality Report for commit SHA 'ca2d286101add1d9a25af42360150cbb4d2fc49b'

Logs show error:

09:28:37 INFO ce[XXXXXX][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=2ms
09:28:39 INFO ce[XXXXXX][o.s.a.c.b.b.BitbucketCloudRestClient] Error returned by Bitbucket Cloud: 400 {"key": "report-service.general.bad-request", "message": "link is not a valid URL", "arguments": {}}
09:28:39 INFO ce[XXXXXX][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=1792ms
09:28:40 INFO ce[XXXXXX][o.s.c.t.CeWorkerImpl] Executed task | project=ProjectName | type=REPORT | pullRequest=31 | id=XXXXXX| submitter=username | status=SUCCESS | time=3105ms

Wasn’t able to get the invalid payload to print out by changing to trace level for ce.

Any hints? Thanks in advance.

Hi,
Does the commit sha1 shown in the analysis warnings correspond to the head commit of the pull request?

1 Like

I read about the auto-merge problem from other topic and rebased against master and made sure the UI showed same SHA for top commit in Bitbucket Cloud as in Sonar UI. Is there a way to guess what kind of links (urls) are sent as part of the integration?

The other topic showed different error for invalid SHA if I’m not entirely wrong. Would bitbucket report invalid commit SHA as invalid link now in API?

Here’s an example of error (disabled automatic branch merging in Bamboo):

Failed to create Bitbucket Cloud Quality Report for commit SHA '71d95403bb4a84c02d1e305b191fc768baf9e2ac'

And Bitbucket Cloud status for PR:

I did some digging into issue, here is possible explanation:
In global settings you have: sonar.core.serverBaseURL variable which can be set to something.
That something MUST be resolvable host (public dns), otherwise you will get from bitbucket:
"link is not a valid URL"

I had private dns name for sonarqube, and got that error. Then I tried reset the value to nothing and it worked. Then I set up alternate hostname in public dns and again - it works.

3 Likes

Thank you @Haralds_Ulmanis , awesome detective work! I can confirm that resetting the value of sonar.core.serverBaseURL in Sonar admin settings made the pull decoration work. We had our internal DNS name there.

@dmeneses do you think there’s something that you could tweak in integration that it would allow non-resolvable DNS names or is this a limitation of Bitbucket? Would it cause missing functionality if this would not be sent at all?

@lahma It took me nearly all day :smiley: That seems 100% bitbucket thing. For some reason it verifies that the host in the link section is resolvable. Not sure if that can be turned off in any way. At least I couldn’t find anything about it.

In general - the only solution (if you want links to issues work) - is to add a public domain host pointing to sonarQube. I did add which points to 10.x.x.x, which is sonarqube. Also I configured that host as serverBaseURL.

1 Like

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