Skip to content

SonarQube backend: Not finding instance key #3937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
skeletonz28 opened this issue May 7, 2025 · 4 comments
Open
2 tasks done

SonarQube backend: Not finding instance key #3937

skeletonz28 opened this issue May 7, 2025 · 4 comments
Labels
bug Something isn't working workspace/sonarqube

Comments

@skeletonz28
Copy link

Workspace

sonarqube

📜 Description

As mentioned before on some closed tickets, I am experiencing the issue with the SonarQube plugin where it is not loading the card due to not finding an instance key
The implementation of SonarQube we are using has been deployed into another team's AWS environment
The have created both a global admin token for me (sqa_) and an encrypted secret key (ending in =)
I am not sure where the instance key or name is meant to be found. There is no summary page that the admins can find.
They have deployed a Community edition if this affects it in anyway

Unsure where the instance name must match or be found. On the Backstage config? On the SonarQube config? Where do we navigate to to find said instance name? There is no summary page on the deployed SonarQube ie: https://bb-sonarqube.npr-bbplfm.{domain}/summary or under admin

👍 Expected behavior

Load the details for the entity in the card

👎 Actual Behavior with Screenshots

Image
Image

Unsure what the instance key is in this regard.

👟 Reproduction steps

If possible, implement an instance of SonarQube in an AWS environment
Generate keys
Create a project
See if the project is found
Find the instance name/key (<-- This is the unknown)

📃 Provide the context for the Bug.

Cannot view details of the project on the entity page
See attached on the actual behaviour

This is my config. I have played around with using instances and not. chaning the name and instance name around to anything I could

sonarqube:
  instances:
  - name: bb-sonarqube.npr-bbplfm
    baseUrl: "https://bb-sonarqube.npr-bbplfm.{domain}"
    instanceKey: "bb-sonarqube.npr-bbplfm"
    apiKey: {either sqa or encrypted key}

And annotation

sonarqube.org/project-key: "bb-sonarqube.npr-bbplfm/BB.Credit.Inter.Technical.AffordabilityService"

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No, I don't have time to work on this right now

@skeletonz28 skeletonz28 added the bug Something isn't working label May 7, 2025
@Parsifal-M
Copy link
Contributor

Parsifal-M commented May 20, 2025

Heya! 👋

I found this comment that maybe clarifies it, however, in your case do you even need the instanceKey? We don't use it and it seems to work for us just with:

sonarqube:
  baseUrl: https://<OURCOMPANYSONARQUBE>.com
  apiKey: <KEY>

I'm wondering if the instanceKey is only needed if you use https://sonarcloud.io (SAAS).

Could you confirm? If that's the case we can add a small addition to the docs to specify this part and make it more clear :)

@skeletonz28
Copy link
Author

Hi @Parsifal-M
Still didn't work as expected
I tried to change the name to default and removed the instanceKey
But I see the call to the API still has it in as part of the params
Have tried playing around with both the config and the catalog annotation, and get varying degrees of either 500 internal error, no such instance etc, or a 200 with no data and the URL has an empty instanceKey

@Parsifal-M
Copy link
Contributor

Hey 👋

Are you using a self hosted Sonarqube or the SAAS Solution? As I think you setup them both differently 😃, also which version are you using of the plugin? I don't think it matters much in this case but just in case.

For example, we use a self hosted solution and it also sends the instanceKey like so:

.../api/sonarqube/instanceUrl?instanceKey=

Probably some improvements we could potentially make around this anyways (maybe we don't even append it to the url if there is no instanceKey set in config etc..)

We have the config setup as I mentioned and then just set the project ID as the annotation like below:

sonarqube.org/project-key: project.project

But it should work for you provided the key has sufficient rights (because it works for us 😄 )

@skeletonz28
Copy link
Author

Hi @Parsifal-M
So its a self-hosted instance.
Plugin versions is -
"@backstage-community/plugin-sonarqube-backend": "^0.8.0",
"@backstage-community/plugin-sonarqube": "^0.12.0",
"@backstage-community/plugin-sonarqube-react": "^0.6.0",

I will play around more with the keys they gave me. But I wonder if they did set up the instance correctly in the first place.
And I worry about the URL and project names, as we have many periods in place. Would that mess up anything?
For instance, URL is
https://{teamName}.{accountName}.{domainName}
Then the project on SonarQube is
BB.Credit.Inter.Technical.AffordabilityService

Could it also be actual communication between our services? Maybe they are not open to send these out, or we can't talk to them etc
Is there maybe some commands you know of I can run on the container to see if it can even talk out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workspace/sonarqube
Projects
None yet
Development

No branches or pull requests

3 participants