SonarQube: 504 Gateway Timeout error

Is SonarQube down? We are getting 504 Gateway error for the site and plus the prepare analysis on Sonarqube task is failing in our pipelines with the same error.

We are on the developer edition 9.4 version

This is the log info from the Prepare Analysis on SonarQube Task in our pipline.

##[debug]organization=undefined

##[debug][SQ] API GET: ‘/api/server/version’ with query “undefined”

##[debug]Response: 504 Body: “504.0 GatewayTimeout”

##[debug][SQ] API GET ‘/api/server/version’ failed, status code was: 504

##[debug]task result: Failed

##[error][SQ] API GET ‘/api/server/version’ failed, status code was: 504

##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET ‘/api/server/version’ failed, status code was: 504

##[debug]Processed: ##vso[task.complete result=Failed;][SQ] API GET ‘/api/server/version’ failed, status code was: 504

Hello @probertson ,

For your SonarQube instance, Sonar doesn’t maintain or have access to your SonarQube instance, so that means we don’t control if it is up or down. That is the responsibility of the network infrastructure connecting your CI/pipeline to SonarQube. You may be running into a network/database optimization issue.

Some questions to consider:

  1. It looks like you are using Azure DevOps. Is this ADO server or ADO services? If ADO server/on-premise, are other 3rd party tools having issues connecting? Are other projects having the same issue?
  2. Can you verify that you can curl or wget (connect) your SonarQube instance from the build agent (if you have self-hosted ADO/on-premise or if you have self-hosted agents)?
  3. Are you using a proxy? Can you bypass the proxy (i.e. ssh to your SonarQube instance) and check your network connection via curl/wget/telnet/etc.?
curl -u <INSERT-USER-TOKEN>: '<INSERT-SQ-HOSTNAME>/api/server/version'
  1. If you are using a reverse proxy or web server in front of SonarQube, check proxy logs with your network administrator team and see if you are able to see the calls from ADO to your SonarQube instance.
  2. Although rare, sometimes connectivity can suffer if you have large processing on the database. Have you rebuilt indexes and refreshed statistics recently on your database? It won’t hurt to do it now if you haven’t done it recently. For PostgreSQL, we have this Sonar community guide.

Hi Joe,

Thanks for replying. We have two projects(iOS and .net) that are running SonarQube. The iOS project build pipeline is failing as well.

  1. We are using Azure Service connection that is hooked into the "Prepare analysis on SonarQube task in our pipeline.
  2. Our Build Agents are Microsoft-hosted
  3. We are not using a reverse proxy. We are running Sonarqube azure app service.
  4. I haven’t tried this but I will.

Thanks for the update.

Please note that this is not a standard deployment we recommend because it requires certain modifications that we do not handle. Are you using the vanderby/SonarQube-AzureAppService? You should check if you are running into any issues by checking the $SQ_HOME/logs folder.

Yes, a simple check with curl should give you truth about the SonarQube server, so you have a few tests to try at least:

  1. Curl from the Microsoft-hosted agent (add a script task)
  2. Curl from within the Azure App Service
  3. Curl from a remote server

Hey Joe, It looks like we are back up and running. I’m not sure why it went down but when checked it yesterday I was able to access my site and run my pipelines.

Thanks for your help!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.