Issue with SonarQube Bitbucket Pipe

I am using Bitbucket Pipelines with the SonarQube pipe (sonarsource/sonarqube-scan:3.1.0). My pipeline script is:

script:
- pipe: sonarsource/sonarqube-scan:3.0.2
variables:
SONAR_HOST_URL: ${SONAR_HOST_URL}
SONAR_TOKEN: ${SONAR_TOKEN}

i’m encountering this error

java.lang.IllegalStateException: Failed to get server version
Caused by: java.net.SocketTimeoutException: Connect timed out

Hey there.

Is your SonarQube Server accessible from your Bitbucket pipeline? Such issues are normally caused by the runner not having access to your SonarQube Server.

This can easily happen if you’re using a Bitbucket-provided runner, but your SonarQube server is on an network resource only accessible internally.