It won't let me do the integration, because it can't find the server

Hello,

I am encountering an issue. I am trying to integrate SonarQube with GitHub Actions for a Laravel project. I followed all the recommended steps for initialization. I am running SonarQube using Docker Compose, but it is showing an error indicating that it cannot find the server, which is preventing me from completing the integration.

Run sonarsource/sonarqube-scan-action@master

with:

projectBaseDir: .

env:

SONAR_TOKEN: ***

SONAR_HOST_URL: ***

/usr/bin/docker run --name d371f85e0eca8eddc145baa7fa922f7138f283_2ce1ce --label d371f8 --workdir /github/workspace --rm -e "SONAR_TOKEN" -e "SONAR_HOST_URL" -e "INPUT_ARGS" -e "INPUT_PROJECTBASEDIR" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -

INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties

INFO: Project root configuration file: /github/workspace/sonar-project.properties

INFO: SonarScanner 5.0.1.3006

INFO: Java 17.0.11 Alpine (64-bit)

INFO: Linux 6.5.0-1022-azure amd64

INFO: User cache: /opt/sonar-scanner/.sonar/cache

ERROR: SonarQube server [localhost:9000] can not be reached

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------

INFO: Total time: 0.232s

INFO: Final Memory: 4M/34M

ERROR: Error during SonarScanner execution

INFO: ------------------------------------------------------------------------

org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)

at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)

at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)

at org.sonarsource.scanner.cli.Main.execute(Main.java:74)

at org.sonarsource.scanner.cli.Main.main(Main.java:62)

Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server

at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)

at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)

at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)

... 7 more

Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'localhost'

at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl$Builder.parse(HttpUrl.java:1327)

at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl.get(HttpUrl.java:917)

at org.sonarsource.scanner.api.internal.shaded.okhttp.Request$Builder.url(Request.java:165)

at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:111)

at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)

at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)

... 10 more

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Hi,

Welcome to the community!

What have you set as your sonar.host.url value? The error indicates that it’s something like localhost:9000 instead of http://localhost:9000. The scanner communicates with the server via standard web calls, so it needs a web URL as the host value.

 
HTH,
Ann

Hello Ann,
Now the solution incorporates ngrok so that the URL can be accessed.

1 Like