Problem with sonarcloud accessing PR's since 2.10.2023

Hello,
we have an error during trying to send scan results to sonnarcloud. Problems shows only on custom branches. It looks like sonar can’t download informations about PR’s:

##[error]12:13:50.956 ERROR: Error during SonarScanner execution
12:13:50.956 ERROR: Error during SonarScanner execution
##[error]java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
##[error]at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
##[error]at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
##[error]at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)

Hi,

Welcome to the community!

What do you mean by “custom” branches? What makes them custom?

Also, could you share the full analysis log, starting from the analysis command? That’ll let us better understand the context of the error.

 
Thx,
Ann

dev.azure.com_iverdevelop_2683a22c-0125-4746-8a3f-f36dd4c0a694__apis_build_builds_38199_logs_7.txt (46.8 KB)
Here you go

Hi,

I’m seeing a 404 in your log:

Caused by: Could not find the pullrequest with key '7619'
Caused by: org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=Spark_Ops&pullrequestKey=7619 : {"errors":[{"msg":"Unable to find the pullrequest with key \u00277619\u0027"}]}

Many systems will return a 404 error (i.e. what you’ve asked for doesn’t exist) rather than a 403 error, thus admitting that the resource exists but you just don’t have access to it.

You should double-check the PAT you’ve configured SonarCloud with. Since all the problems trace to a particular day, it’s quite possible the old PAT expired right before that.

 
Ann

I switched the PAT to new one. I didn’t helped :confused:

Hi,

Can you verify that a PR #7619 exists on the Azure(?) side?

Can you also verify that the new PAT you’re using has full permissions on the Spark_Ops project?

 
Thx,
Ann

I created them myself and I am 100% sure Also I regenerated the PAT to do this.

1 Like

Hi,

Thanks for the confirmation. I’ve flagged this for the team.

 
Ann

I have new finding.
The sonarcloud analysis only doesn’t work when it’s triggered by PR. When I run it on my branch it works normally.

1 Like

Hello @Piotr_Laczykowski ! :slightly_smiling_face:

I’ll take a look into your issue. I can see you’ve done some troubleshooting with Ann, still, I would like to try a couple more things.

I worked on another Community thread similar to yours. Could you please try my suggestion here: SonarCloud Pull Request Run not working - #19 by aura ?

In your case, the URL would be something like https://dev.azure.com/{AzureDevOpsOrg}/_apis/git/repositories/Spark_Ops/pullRequests/7619?api-version=6.0 (replacing the organization name with your own).

Could you please share your findings here following what’s mentioned in the other thread?

Yeah nothing helps. I can see that to solution for this case was creating a new project.

That was the other case but could you please send me the information about what are you getting with the curl command using the URL from your project and using the PAT?

Curl works but there is no info after that

Hello again @Piotr_Laczykowski

No info returned by the curl command is an indicator that there must be something wrong with the PAT being used. We had a similar thread about this (see this reply).

Based on that other thread, could you please confirm the following?

  • Try the other URLs suggested in the thread to test the PAT using curl
  • The user that is creating the PAT has access type Basic (see access levels here)
  • The PAT created and used in SonarCloud follows this documentation.
1 Like


I found another thing. I can’t find my project in sonarcloud at all

If you can’t find your projects in SonarCloud, this leads me to think the PAT you have configured in SonarCloud for the Azure DevOps connectivity is not valid.

Could you please go to SonarCloud and go to your Organization Administration section and then under Organization Settings go to Azure DevOps connectivity management to make sure the message under Personal Access Token indicates the token is valid?

If the token is invalid, you’ll see something like:

If this is the case, then please update the PAT with the new value you have from Azure DevOps and this will look now like:

Please find more information about the SonarCloud Azure DevOps documentation here.

I’ve just recreated manually projects and it works now

1 Like