Project does not appear to be binded in SonarLint

Hello, we’re trying to configure SonarLint in both IntelliJ and VSCode, but none of them locates the intended project in our connected server. We can see other projects, but not ours.

The ID is correct, my user has all permission boxes enabled and the project is being normally scanned through our GitLab pipeline. The issue is exclusively in the IDEs’ access we’re trying to use.

  • Operating system: Windows 11 Enterprise 64b
  • IDE name and flavor/env: Both IntelliJ IDEA 2023.3.3 (Ultimate Edition) and Visual Studio Code 1.87.2

Hi,

Can you clarify the versions of SonarLint you’re experiencing this in?

 
Thx,
Ann

Sure.

In VSCode: v4.4.1
In IntelliJ: 10.4.0.77904

1 Like

Hi @KarlaDell, are you connected to a SonarQube server or SonarCloud? If you are connected to SonarQube, which version is it?

My first guess would be a permission issue. If you use a token, it should have permission to view the project; if you use a username/password, the user account should have permission to view the project.

Hello, thanks for trying to help. We’re using SonarQube Data Center EditionVersion 9.9.2 (build 77730). My user has full permissions checked in the project, and I’m indeed using a user token. So I’m afraid that option is not valid for the scenario.

Could you navigate to User > My Account > Security and check the token you are using. What type is it?

Could you also try to execute the following curl request:

curl -u <SQ_TOKEN>: "https://<SQ_URL>/api/components/search?qualifiers=TRK"

It will list all the projects you are allowed to see, normally, you should see the project you are looking for.

1 Like

It’s a user token.

Also, with curl I only get a small list of projects (the server has many more). It only gives me back 100 records while in the server there are more than 17 thousand.

To make the request a bit more precise, you can provide the following parameters:

curl -u <SQ_TOKEN>: "https://<SQ_URL>/api/components/search?qualifiers=TRK&p=1&ps=500&q=<PROJECT_NAME>" 

q will limit the search to:

  • project names that contain the supplied string
  • project keys that are exactly the same as the supplied string

I want to ensure that you can retrieve the project information via curl. If not, I will move the ticket to the SonarQube team directly, as I don’t think it’s an issue coming from SonarLint.

Thanks a lot for trying to help.

I used the parameters and with that my project comes first in the response with curl.

Thanks, we’re making progress!

In this case, I wonder if the issue is because of the many projects on your SonarQube server. Can you enable the SonarLint logs and check if you see the following message (after having searched for your project):

Limiting number of requested pages from '{}' to {}. Some of the data won't be fetched

Sure, here it is:

[Debug - 08:41:35.650] Limiting number of requested pages from ‘api/components/search.protobuf?qualifiers=TRK’ to 20. Some of the data won’t be fetched

1 Like

Thanks, I think the issue is clear. We currently limit the number of projects we can fetch to 10,000, so your project is likely not retrieved. I will assign the thread to the appropriate team so they can see what could be improved here.

In the meantime, the only workaround I can think of would be to limit the scope of projects you can access in SonarQube.

1 Like

Thank you, Nicolas. Is there any chance we could ask this to be prioritized?

Thinking about a workaround, I totally forgot, but you can directly provide your SonarQube project key in the input field. The project key can be found in the URL of your SonarQube project, for example:

https://<SQ_URL>/dashboard?id=<PROJECT_KEY>

Then copy and paste the value here:

image

2 Likes

I tried that before, but unfortunately, when I do that I get:
image

Unless I should add something else with the key. Is that the case?

You can also get the project key by going to the project page and heading to Project Information. On this page, you should see the project key:

image

(The project key in the URL is encoded, so it will likely fail unless you replace the characters)

Yes, that’s what I tried (retrieving from the UI). But this didn’t work in VSCode.
I’ll try again in IntelliJ, but can you think of another workaround for VSCode?

It doesn’t give me any binding errors in IntelliJ (by writing the project key), but it also won’t really throw me the vulnerabilities issues that it gives me on the UI. It might be a different issue, but I’m assuming that maybe it’s not binding as it should.

Hi again, @nicolas.quinquenel. Do you think this fix is something we can expect to be available anytime soon?

Hello, is there someone we could tag and maybe get some updates about this fix?