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)
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.
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?
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?
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.
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: