SonarCloudAnalyze@1 throws okhttp3.internal.platform.Platform error

versions used

SonarCloudAnalyze@1 as available in azure devops

error observed

I have a dotnet core project, I use azure CI pipeline to build, test and analyze with sonar

Everything works, project is analyzed, data is published to sonarcloud.

However, there is an error thrown and reported by azure pipeline

##[error]Nov 18, 2019 9:53:36 AM okhttp3.internal.platform.Platform log

steps to reproduce

  • create an azure devops project
  • have a dotnet project hosted with github
  • add azure-pipeline.yml, an example below; do use SonarCloudPrepare@1, SonarCloudAnalyze@1 and SonarCloudPublish@1

potential workaround

None. However, the build passes, it’s just the error is highlighted and makes the whole build look like it’s hiding an error.

  - job: ${{ }}
      vmImage: ubuntu-latest

      - task: SonarCloudPrepare@1
        displayName: 'Prepare sonar'
          SonarCloud: 'Workload-SonarCloud'
          organization: ui
          projectKey: '${{ parameters.artifact }}'
          projectName: '${{ parameters.artifact }}'
          extraProperties: 'sonar.cs.opencover.reportsPaths=$(Build.ArtifactStagingDirectory)/${{ parameters.artifact }}/coverage/coverage.opencover.xml'

      - powershell: |
          dotnet tool install --global coverlet.console
        displayName: Install corvelet

      - task: DotNetCoreCLI@2
        displayName: Restore
          command: restore
          projects: '**/${{ parameters.workingDirectory }}/*.sln'

      - task: DotNetCoreCLI@2
        displayName: Build
          command: build
          projects: '**/${{ parameters.workingDirectory }}/*.sln'
          arguments: '--configuration Release'

      - task: DotNetCoreCLI@2
        displayName: Test
          command: test
          projects: '**/${{ parameters.workingDirectory }}/*.sln'
          arguments: "--configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(Build.ArtifactStagingDirectory)/${{ parameters.artifact }}/coverage/"

      - task: SonarCloudAnalyze@1
        displayName: 'Run sonar'

      - task: SonarCloudPublish@1
        displayName: 'Publish sonar'


Can you please send us the log of the SonarCloudAnalyze task that raised this log ?

Thank you.


Same error for me during a .Net Console app build

The log for SonarCloudAnalyze@1 that shows the error older-log.txt (154.9 KB)

However, on newer runs, the error went away newer-log.txt (141.7 KB)

The only difference that I see is that the newer runs are configured to be automatically triggered by Azure Devops based on the fact that they are pull requests.

The older runs were also pull requests, but were triggered manually. Guess this is visible in log, if you compare the old with the new.

Thank you.

On the first log getting the error, i saw this message : You’re not authorized to run analysis. Please contact the project administrator.

Are you using the same token/user for both builds ? Can you make sure that this token/user is correct and has sufficient rights in the context of the build with the error ?

Thanks !

In both runs I had data sent to sonarcloud, so all in all, I don’t think there was a connectivity issue due to authentication/authorization issue. It’s possible that for the second run I used a different service connection, but both managed to get the data to sonarcloud.

We are seeing the same problem across a whole bunch of VSTS builds…

2019-11-21T04:03:09.0775323Z ##[error]Nov 21, 2019 4:03:09 AM okhttp3.internal.platform.Platform log
2019-11-21T04:03:09.0783835Z Nov 21, 2019 4:03:09 AM okhttp3.internal.platform.Platform log
2019-11-21T04:03:09.0784024Z WARNING: WARNING: A connection to was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);



I created this ticket to troubleshoot the isssue :

We’ll investigate it as soon as possible.