Builds Failing due to api access

Must-share information (formatted with Markdown):
We are scanning from bamboo
Sonar scanner MSBUILD v4.10
Sonarqube v8.4.1

We are receiving the following errors apparently it cannot connect o the api

|build|20-Jan-2021 15:33:21|SonarScanner for MSBuild 4.10|
|---|---|---|
|build|20-Jan-2021 15:33:21|Using the .NET Core version of the Scanner for MSBuild|
|build|20-Jan-2021 15:33:21|Pre-processing started.|
|build|20-Jan-2021 15:33:21|Preparing working directories...|
|build|20-Jan-2021 15:33:21|15:33:21.454  Updating build integration targets...|
|build|20-Jan-2021 15:33:21|15:33:21.473  Fetching analysis configuration settings...|
|error|20-Jan-2021 15:35:01|15:35:01.844  Failed to request and parse 'https://sonar/api/languages/list': An exception occurred during a WebClient request.|
|error|20-Jan-2021 15:35:01||
|error|20-Jan-2021 15:35:01|Unhandled Exception: System.Net.WebException: An exception occurred during a WebClient request. ---> System.OperationCanceledException: The operation was canceled.|
|error|20-Jan-2021 15:35:01|   at System.Net.HttpWebRequest.GetResponse()|
|error|20-Jan-2021 15:35:01|   at System.Net.WebClient.GetWebResponse(WebRequest request)|
|error|20-Jan-2021 15:35:01|   at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)|
|error|20-Jan-2021 15:35:01|   --- End of inner exception stack trace ---|
|error|20-Jan-2021 15:35:01|   at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)|
|error|20-Jan-2021 15:35:01|   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)|
|error|20-Jan-2021 15:35:01|   at System.Net.WebClient.DownloadString(Uri address)|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass11_0.<GetAllLanguages>b__0()|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.BootstrapperClass.Execute()|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)|
|error|20-Jan-2021 15:35:01|   at SonarScanner.MSBuild.Program.Main(String[] args)|
|error|20-Jan-2021 15:35:01|/opt/appl/bamboo/tools/sonar-scanner-msbuild/scripts/sonar-scanner-msbuild-4.10.0.19059.sh: line 4: 52005 Aborted                 /opt/appl/bamboo/tools/dotnet-core/symlinks/dotnet /opt/appl/bamboo/tools/sonar-scanner-msbuild/install/sonar-scanner-msbuild-4.10.0.19059/SonarScanner.MSBuild.dll "$@"|
|simple|20-Jan-2021 15:35:01|Failing task since return code of [/opt/appl/bamboo/tools/sonar-scanner-msbuild/scripts/sonar-scanner-msbuild-4.10.0.19059.sh begin /k:toolchain:test-connection /name:test:test23 /version:1] was 134 while expected 0|
|simple|20-Jan-2021 15:35:01|Finished task 'Command' with result: Failed|

and another when trying to fetch the version

error	20-Jan-2021 11:39:34	11:39:34.085  Failed to request and parse 'https://sonar/api/server/version': An exception occurred during a WebClient request.
error	20-Jan-2021 11:39:34	
error	20-Jan-2021 11:39:34	Unhandled Exception: System.Net.WebException: An exception occurred during a WebClient request. ---> System.OperationCanceledException: The operation was canceled.
error	20-Jan-2021 11:39:34	   at System.Net.HttpWebRequest.GetResponse()
error	20-Jan-2021 11:39:34	   at System.Net.WebClient.GetWebResponse(WebRequest request)
error	20-Jan-2021 11:39:34	   at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
error	20-Jan-2021 11:39:34	   --- End of inner exception stack trace ---
error	20-Jan-2021 11:39:34	   at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
error	20-Jan-2021 11:39:34	   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
error	20-Jan-2021 11:39:34	   at System.Net.WebClient.DownloadString(Uri address)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass15_0.<DownloadServerVersion>b__0()
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.SonarWebService.DownloadServerVersion()
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.BootstrapperClass.Execute()
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
error	20-Jan-2021 11:39:34	   at SonarScanner.MSBuild.Program.Main(String[] args)
error	20-Jan-2021 11:39:34	/opt/appl/bamboo/tools/sonar-scanner-msbuild/scripts/sonar-scanner-msbuild-4.10.0.19059.sh: line 4: 57853 Aborted                 /opt/appl/bamboo/tools/dotnet-core/symlinks/dotnet /opt/appl/bamboo/tools/sonar-scanner-msbuild/install/sonar-scanner-msbuild-4.10.0.19059/SonarScanner.MSBuild.dll "$@"

Thanks for the help.

Hi,

When happens when you request that URL from your desktop? I have a suspicion that this is down to a proxy or something similar blocking access from the build agent to the SonarQube server.

 
HTH,
Ann

Going to to url from the desktop works fine.
curl to sonar base URL works fine but curl to the /api just hangs when we attempt it from the machine. wget howver works fine when contacting the /api URL.
BR,
Ian

Hi Ian,

Okay, this is not on the SonarQube / analysis side. This is on the box / network side.

 
Ann