Cannot analyze pull requests in bound projects between SonarCloud and Bitbucket Cloud


I have been trying to analyze with SonarCloud pull requests and getting the following error

ERROR: Error during SonarScanner execution
ERROR: Something went wrong while trying to get the pullrequest with key ‘1859’
ERROR: Caused by: Error 500 on : {“errors”:[{“msg”:“An unexpected error occurred. Please try again later.”}]}

This error appears after the line INFO: Load branch configuration and the warning that appears in sonarcloud is that * Could not find ref ‘master’ in refs/heads, refs/remotes/upstream or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.

This problem only occurs in projects that are bound between a project in Bitbucket Cloud and a Project in SonarCloud.

Any idea how can I solve the issue?
Thank you.

A 500 is very strange here. Are you still facing the issue?

Hi Colin,
Thanks for you interest. I have created a new pull request and tried again, and I am still experiencing the error.
The sonar command I am using is:
sonar-scanner -Dsonar.organization=org -Dsonar.projectKey=proj-dev -Dsonar.sources=. -Dsonar.pullrequest.key=1860 -Dsonar.pullrequest.branch=sonarcloud-test-pull-request -Dsonar.pullrequest.base=master -Dsonar.javascript.node.maxspace=8192 -Dsonar.javascript.allowTsParserJsFiles=false

And further info about the scanner and SO:
INFO: SonarScanner
INFO: Java 11.0.3 Oracle Corporation (64-bit)
INFO: Mac OS X 10.16 x86_64

Thank you.

I will reach out for some private details.

Good day Maria,

Are you still facing this issue?
If yes, can you please make sure that the PR target branch is fetched to your local repository?

1 Like

Hi Alexander,
Thank you for your response and interest.
Yes, I am still facing the issue, and I checked that the PR target branch is fetched in local. In fact, we follow the same procedure for the other projects that do work, without the only difference that the projects that fail are the ones that are bound with bitbucket.
I have provided the log to Colin in a private message.
Best regards.

Dear all,
I found the solution to this problem. I tried to bound both applications from Bitbucket, when installing the app SonarCloud from marketplace. The installation process did not bind both applications successfully, since the wizard kept asking to create a new organization.
The solution adopted was trying to bind both applications from the SonarCloud perspective.
The process I followed was, “Organization settings”, “Bind this organization to Bitbucket”, click on bind and the problem was solved.
Thank you and best regards.

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