Error observed with new sonarsource/sonarcloud-github-action@master (3.1.0 version to be specific)

  • ALM used - GitHub
  • CI system used - Azure DevOps
  • Languages of the repository - Typescript
  • Error observed
ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: Failed to get server version'
'Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no scheme was found for /api/s...

    at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1261)
    at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1634)
    at okhttp3.Request$Builder.url(Request.kt:184)
    at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callUrl(ScannerHttpClient.java:142)
    at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callApi(ScannerHttpClient.java:126)
    at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callWebApi(ScannerHttpClient.java:112)
    at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.getServerVersion(ScannerEngineBootstrapper.java:192)
... 3 common frames omitted'
Steps to reproduce - GutHub actions attempted to run sonarsource/sonarcloud-github-action@master
  • Potential workaround - For now we can just reduce the version to v3.0.0

Hi,

Welcome to the community!

To be clear, your code is stored in Azure, but you’re building on GitHub with GitHub actions?

Would you mind sharing your configuration, redacted as necessary?

 
Thx,
Ann

Hi Ann,

Code is stored in GitHub. We are using GitHub actions to build an npm library that we use for our application. As you can see when we try to run the new version of sonarsource/sonarcloud-github-action@master we get the issue above. Code is open source, so you should be able to see the workflow file here: ccd-case-ui-toolkit/.github/workflows/npmpublish.yml at master · hmcts/ccd-case-ui-toolkit · GitHub

Thanks,
Connor

1 Like

Hi Connor,

Thanks for the link. I didn’t think it was the case, but I wanted to make sure there was no half-configured sonarcloud.io URL in there.

I’m going to flag this for the team.

 
Ann

Hi @connormcelroycgi

We changed the default value of the host to sonarcloud.io, unifying the way for configuring the host URL as the source of truth. If not set, we default to sonarcloud.io, so no further host configuration is required on your end unless you want to interact with a different host or sonarqube for some testing purposes.
Also it is an option to set specifically to https://sonarcloud.io if you wish to enforce the property.

However, we can see that in your sonar.project properties ccd-case-ui-toolkit/sonar-project.properties at master · hmcts/ccd-case-ui-toolkit · GitHub you set empty sonar.host URL.
Can you please remove the line? that seems to override the host URL from sonarcloud.io to an empty host.

Previous behavior was limiting this ability and always overriding the user input via CLI/Env variables, but that is not in line with sonar.scanner configuration.

Please let us know if you face more issues.

Thanks
Csaba

1 Like