Sonar4Stash Forbidden

David Harper November 9, 2015

I recently upgraded our Stash to Bitbucket 4.1.0, Sonar4Stash 1.4.0 and Sonarqube 5.1.2

This has made it stop working properly. We still get the summary panel in Pull Requests, but we never get any balls in the diff or anything returning when we click the icon.

In the Chrome Console the 4 AJAX requests all return an empty set, with coverage and duplicate lines throwing a 204 error. Looking in actual Sonarqube there are errors in the files that should be being picked up. 

The lines in the log below have NULL as a project name, however I keep resetting this in the Bitbucket config, which shows the correct project key there. This is the same for all of our projects. 

The project authenticates fine in the settings panel, and that user has the same admin permissions as it did previously. Being able to see the full REST call it was making internally would be helpful!

In the log after debug mode, we get:

2015-11-10 10:14:00,668 DEBUG [http-nio-7990-exec-7] david.harper @Q7GD7Bx614x168198x1 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git ls-tree refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services: -r
2015-11-10 10:14:00,688 DEBUG [http-nio-7990-exec-3] david.harper @Q7GD7Bx614x168199x2 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/coverage HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git ls-tree refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services: -r
2015-11-10 10:14:00,697 DEBUG [http-nio-7990-exec-6] david.harper @Q7GD7Bx614x168200x3 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/duplicatelines HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git ls-tree refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services: -r
2015-11-10 10:14:00,701 DEBUG [http-nio-7990-exec-6] david.harper @Q7GD7Bx614x168200x3 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/duplicatelines HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git cat-file -p refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services:sonar-project.properties
2015-11-10 10:14:00,711 ERROR [http-nio-7990-exec-6] david.harper @Q7GD7Bx614x168200x3 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/duplicatelines HTTP/1.1" c.m.s.s.s.d.SonarDuplicateResource SONAR: 403 failed to retrieve duplicate line information: Forbidden
2015-11-10 10:14:00,711 WARN  [http-nio-7990-exec-6] david.harper @Q7GD7Bx614x168200x3 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/duplicatelines HTTP/1.1" c.m.s.s.s.d.SonarDuplicateResource SONAR: No Sonar information found for file null:feature/WFBO-2982-duplicate-accounts-on-client-services:public/bo/ajax/dashboard/ComplianceNewRegistrations/getNewRegistrationsList.php: Forbidden
2015-11-10 10:14:00,772 DEBUG [http-nio-7990-exec-7] david.harper @Q7GD7Bx614x168198x1 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git cat-file -p refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services:sonar-project.properties
2015-11-10 10:14:00,792 DEBUG [http-nio-7990-exec-3] david.harper @Q7GD7Bx614x168199x2 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/coverage HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git cat-file -p refs/heads/feature/WFBO-2982-duplicate-accounts-on-client-services:sonar-project.properties
2015-11-10 10:14:00,799 ERROR [http-nio-7990-exec-3] david.harper @Q7GD7Bx614x168199x2 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/coverage HTTP/1.1" c.m.s.s.s.c.SonarCoverageResource SONAR: 403 failed to coverage information: Forbidden
2015-11-10 10:14:00,799 WARN  [http-nio-7990-exec-3] david.harper @Q7GD7Bx614x168199x2 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/coverage HTTP/1.1" c.m.s.s.s.c.SonarCoverageResource SONAR: No Sonar information found for file null:feature/WFBO-2982-duplicate-accounts-on-client-services:public/bo/ajax/dashboard/ComplianceNewRegistrations/getNewRegistrationsList.php: Forbidden
2015-11-10 10:14:00,925 DEBUG [http-nio-7990-exec-7] david.harper @Q7GD7Bx614x168198x1 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.s.i.s.g.p.DefaultPullRequestRefHelper WFBO/back-office[60]:1551@5: Using cached merge from v5
2015-11-10 10:14:00,925 DEBUG [http-nio-7990-exec-7] david.harper @Q7GD7Bx614x168198x1 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.s.i.s.g.p.DefaultPullRequestRefHelper WFBO/back-office[60]:1551@5: Resolved effective diff from f5c7abcab552fcad8125893acfd06fa2fefa36e6 to ff764a3016455b929f033291d67bd72703c75eeb (CLEAN)
2015-11-10 10:14:01,030 DEBUG [http-nio-7990-exec-7] david.harper @Q7GD7Bx614x168198x1 1kfpji0 10.254.6.102,127.0.0.1 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.bitbucket.scm.BaseCommand Executed /usr/bin/git diff -C --color=never -U0 --dst-prefix=dst:// --src-prefix=src:// f5c7abcab552fcad8125893acfd06fa2fefa36e6 ff764a3016455b929f033291d67bd72703c75eeb -- public/bo/ajax/dashboard/ComplianceNewRegistrations/getNewRegistrationsList.php

1 answer

1 accepted

0 votes
Answer accepted
Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 10, 2015

Hi,

which version of the plug-in were you using before the upgrade? 1.3.0?

What kind of build system are you using to trigger SonarQube (SonarRunner, Maven, Gradle, ...)?

It looks like the plug-in was not able to determine the project key from your build files for the file getNewRegistrationsList.php.

If you are using SonarRunner, have you specified a "sonar.projectKey" in your sonar-runner.properties file?

Best regards,

Michael (author of the plug-in)

David Harper November 10, 2015

Hey Michael,

Yup, it was 1.3.0 before

SonarRunner as a build trigger. The log shows the project key which it picks up from sonar-runner.properties file in each repository, such as 

Acquire semaphore on project : org.sonar.api.resources.Project@37a20de7[id=<null>,key=Company:Product:bugfix/WFBO-9999-code-improvement-on-compliance,qualifier=TRK], with key batch-Company:Product:bugfix/WFBO-9999-code-improvement-on-compliance

This all makes it back into Sonarqube as it used to.

---

We changed the DNS name to bitbucket, added an apache 301 redirect from the old name to it and updated the Base Name inside Bitbucket itself? Could something be cached that's looking for the old name?

Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

I don't think so, as the plug-in seams to be able to connect to SonarQube by showing the statistics in your pull request. It is indeed strange that you see null in the error message of "No Sonar information found for". That means that the currently selected file in the pull request could not be determined. Do you see this null value in the REST call to /rest/sonar4stash/1.0/sonarissues when you open a file in a pull request in Stash? You will probably see the query parameter "filePath=null" then...

David Harper November 11, 2015

Have you got a more private method of sending debug information? I'll update here if we get to an answer.

Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

Sure! You could either send us an e-mail to our support address or you could create an issue in our JIRA. You'll find both in our Marketplace listing under the "Support" tab.

David Harper November 11, 2015

Made a JIRA ticket :)

Eduard Wirch November 17, 2016

Which one?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events