Failed to request and parse

Hi guys,
I am working with Sonarqube Enterprise edition and facing a problem while accessing the sonarqube target url “https://devops.sonarq.prd.prd.bfsaws.net”…

The Jenkin’s pipeline is configured to trigger the scan, while running the build it’s failing with the error “Failed to request and parse ‘https://devops.sonarq.prd.prd.bfsaws.net/api/server/version’: A task was canceled.”

There is no proxy between the servers.When i access this server and type this URL at browser and it returns the Sonarqube version “9.9.6.92038”.
MSBuild version is 5.4

I have verified the firewall , network settings for the server, everything seems to be working fine, as respective teams have checked it all that there is no communication issue. through the browser target url “https://devops.sonarq.prd.prd.bfsaws.net” is accessible.

Below is the error log
[03:32:44.707 03:32:44.69 Loading analysis properties from C:\SonarQube\sonar-scanner-msbuild-5.4.0.40033-net46\SonarQube.Analysis.xml
03:32:44.707 03:32:44.707 sonar.verbose=true was specified - setting the log verbosity to ‘Debug’
03:32:44.713 Updating build integration targets…
03:32:44.719 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
03:32:44.719 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
03:32:44.72 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
03:32:44.72 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
03:32:44.72 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
03:32:44.72 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
03:32:44.721 The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\sa-projdevops-dev\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
03:32:44.729 Installed SonarQube.Integration.targets to D:\Jenkins\workspace\MyProj\Tax 3.0 SonarQube Scanner\SonarScan_Tax3.0.sonarqube\bin\targets
03:32:44.731 Creating config and output folders…
03:32:44.733 Creating directory: D:\Jenkins\workspace\MyProj\Tax 3.0 SonarQube Scanner\SonarScan_Tax3.0.sonarqube\conf
03:32:44.733 Creating directory: D:\Jenkins\workspace\MyProj\Tax 3.0 SonarQube Scanner\SonarScan_Tax3.0.sonarqube\out
03:32:44.778 Downloading from https://devops.sonarq.prd.prd.bfsaws.net/api/server/version
03:34:24.804 Failed to request and parse ‘https://devops.sonarq.prd.prd.bfsaws.net/api/server/version’: A task was canceled.

Unhandled Exception: System.Threading.Tasks.TaskCanceledException: A task was canceled.]

Could someone please help to understand and fix this issue.

Hey there.

Is that true for your Jenkins agent, or just your personal machine?

You could try this out directly in your Jenkins pipeline – for example, adding a task that runs a curl command: curl https://devops.sonarq.prd.prd.bfsaws.net/api/server/version

This version of the Scanner for .NET is more than 3 years old. I suggest any further testing you do is done with the latest version, v9.0.2.

Hi Colin,
Thank you for the suggestion.

[
I have verified the firewall , network settings for the server, everything seems to be working fine, as respective teams have checked it all that there is no communication issue. through the browser target url “https://devops.sonarq.prd.prd.bfsaws.net” is accessible.
]

Is that true for your Jenkins agent, or just your personal machine?

-Yes, this is true for jenkins agent.

-Yes i have tried https://devops.sonarq.prd.prd.bfsaws.net/api/server/version directly in jenkins pipeline, still getting the same issue.

i will surely try to scan with the latest version of MSBuild.

Please have a look at the below code which i have written in pipeline script, having project key, target url and login token.

args = sonarMSbuild + " begin /k:"MyProjKey" /d:sonar.host.url="https://devops.sonarq.prd.prd.bfsaws.net" /d:sonar.verbose=true /d:sonar.login="[REDACTED]""

bat args

args = '"C:\\Program Files\\dotnet\\dotnet.exe" build .\\BRPJ.MyProj.sln -c Release /p:Platform="Any CPU"' //msbuildPath + " " + pathToSolution + " /t:Rebuild"

bat args

args = sonarMSbuild + " end /d:sonar.login=\"[REDACTED]\" "   

bat args

Please suggest if anything doesn’t looks correct.

It all looks correct. Please try using the latest version of the Scanner for .NET and bring new logs if it still doesn’t work!

1 Like