BitBucket code quality Widget in Pull Request fails with 404

Using SonarCloud, Bitbucket and Bitbucket Pipe for analysis

When creating a pull request building the code using Bitbucket Pipelines and running the SonarCloud pipe, the code Quality widget in the Pull Request is blank. The underlying error is “404 - Pull Request not found”

This URL is executed by the widget:{REPO_UUID}&jwt=******

The prId matches the pull request ID on the repo, the UUID also matches that from the bitbucket API. In the SonarCloud dashboard, I can see the pull request and it has correctly determined the information (branches, id, commit, etc).

The response is
{"errors":[{"msg":"Pull Request not found"}]}

I would expect a code quality report to be returned indicating if the code passed Sonar checks.

I’ve removed and reinstalled the SonarCloud plugin to Bitbucket with no effect.

A post was split to a new topic: BitBucket widget not displayed when using Edge

Hi @John_Lister , thanks for reporting this issue, I’ll have a look.
I split the other issue to another thread, since it seems to be a display issue. Someone else will take care of it.


Thanks Claire, I only realised there was also a display issue when a colleague using chrome showed me the quality gate working in a PR.
I suspect the issue is down to using mono-repos, I’m guessing the widget service is looking for a single sonar project for the repository rather than finding the actual project(s) associated with the pull request. I appreciate that having multiple sonar projects with a PR may make this complicated…

Hi @John_Lister

Thanks for the hint about the mono repository.
Monorepos are supported on BitBucket Cloud, including on the PR widget, but we may have a bug here.
Is there a chance that the PR is analyzed on only some of the SonarCloud projects?
For example if you have 2 SonarCloud projects, P1 and P2, both bound to your BitBucket repository, do the PR exist only on P1 and not on P2 for example?

Hi Claire, just looking through the PRs, I’ve just found an example where it works, using your hint about covering some projects.
For example in this case, the repository has 12 services stored in separate sub-folders, with each service defined as a mono-repo project in SonarCloud. I can see all projects in SonarCloud and for an specific project the pull requests that include the changed services(projects). For example here are the PRs for a single service/project and the PRs that include it:

Normally we would only update a single service at a time, in this instance I can see the “build” in BitBucket for the Sonar analysis and that the pull request is registered in SonarCloud (circled red in the image above). But the widget fails to load anything and I get the “not found” error:

If I compare this to a PR that has all 12 services included (circled green above). You can see that the widget now works.

I’d expect the widget to work regardless of the number of projects included and show only those that were part of the pull request. Following a component based development model with a mono-repo, we would very rarely change multiple projects in a build, hence splitting it across multiple Sonar projects for individual analysis.


Thanks for the detailed example John, it confirms both my intuition and that something is not working as we expect.
I also expect that the widget is shown even if the PR has not been analyzed in all the SonarCloud projects.
A fix is in progress and should be deployed in a few days, I’ll inform you when it’s done.

@John_Lister the fix has been deployed, the widget should now display the results for the projects the PR has been analyzed on, even if it has not been analyzed on all the projects. Could you confirm it works and mark my post as the solution? Thanks

1 Like

Thanks Claire for the prompt fix, I can see it working now.

1 Like

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