SonarCloudPublish@1 step in AzDo throwing 404 Error

Template for a good new topic, formatted with Markdown:

  • ALM used Azure DevOps

  • CI system used Azure DevOps

  • Languages of the repository: TypeScript(.js, .vue files)

  • Error observed
    Hi

I hope this message finds you well. I’ve been encountering the same issue over the past few days. I’m using SonarCloud in an Azure DevOps pipeline for PR analysis of a TypeScript project. However, in the SonarCloudPublish@1 step, I’m facing a failure with the following error:

##[error][SQ] API GET ‘/api/ce/task’ failed, status code was: 404
##[error][SQ] Could not fetch task for ID ‘AY3pk2SqC6LpY66u24U_’

Interestingly, when I use Postman to hit the same API endpoint, I can see the results. Could you please assist in resolving this issue?

Thanks

Hi,

Many systems will return a 404 error (i.e. what you’ve asked for doesn’t exist) rather than a 403 error, thus admitting that the resource exists but you just don’t have access to it.

When you use Postman to make the call, I suppose you’re explicitly supplying your analysis token, right? I suspect the problem in your pipeline is that the token isn’t being passed or it’s been mangled somehow.

 
HTH,
Ann

Hi Ann,

Thank you for your response. I’d like to mention that we include the Sonar token in the pipeline under the SonarCloud analyze step as an extra property, formatted as sonar.login={TOKEN}. I tried the same token using Postman.

Best regards,
Sourav

Hi,

Can you share your full log?

 
Thx,
Ann

Hi Ann,
Can you please ping me in private? I will be happy to share the logs there.
In the meantime, if you have any resource handy which would help me to setup sonarcloud with AzureDevops for a Typescript project?

Thanks,
Sourav

Hi Sourav,

Feel free to redact as necessary.

Regarding the TypeScript project, just import it using SonarCloud’s onboarding wizard. It should get you going.

 
Ann

Hi Ann,
Thanks for responding.
We have the following steps in the AzDo pipeline. Please let me know if I need to share logs for all steps or any specific steps:

Checkout
Sonar Cloud Prepare
Sonar Cloud Analyze
Sonar Cloud Publish

Thanks,
Sourav

Hi Sourav,

Yes, the whole thing, please.

 
Thx,
Ann

Hi Ann,

Attached is the complete log. Your assistance is highly appreciated.

I’d like to highlight that the Sonar Cloud Analysis step is successfully publishing the results, visible in SonarCloud for the specific project (Last Analysis timestamp corresponds to the pipeline run time). Could you please confirm if proceeding without the publish step is acceptable?

Thanks,
Sourav

Hi,

Thanks for the log. Could you also share your pipeline?

 
Thx,
Ann

Hi Ann,
Please find the yml attached.
Thanks,
Sourav

OMS Pull Request Analysis Pipeline.zip (1.3 KB)

Hi Sourav,

Thanks for the pipeline.

I think this is about providing the token to the publish step. And BTW, there is a task for that: - task: SonarCloudPublish@1. What’s not clear to me from either the docs or the examples is how you’re uniformly supposed to provide the token. I believe it’s with the SonarCloud Server Endpoint you defined in your projects Service connections during setup. There’s an example here of using it, but I’m not finding much consistency around that.

So I’m going to raise that internally.

 
Ann

Hi Ann,

Appreciate your response. Previously, you suggested using the built-in SonarCloud wizard for analyzing TypeScript projects. However, the wizard seems to provide commands related to SonarQube. Could you please confirm this and, if possible, direct me to relevant documentation?

Thanks,
Sourav

Hi Sourav,

Can you give me an example?

 
Thx,
Ann

Hi Ann,

Please refer to the following screenshot.

Here, I am asked to download and unzip the sonar scanner, then use the following commands:
sonar-scanner
-Dsonar.organization=caseys01
-Dsonar.projectKey=caseys01_commerce-oms-test1
-Dsonar.sources=.
-Dsonar.host.url=https://sonarcloud.io

However, this is not the approach we follow in rest of our pipelines concerning Java projects.

Thanks,
Sourav

Hi Sourav,

You’ve chosen “Other (for JS, TS, Go, Python…”, so it’s quite natural that you get instructions that are different from when you choose a Java-centric build technology.

I’m not sure what you expected…?

 
Ann

Thanks for the insight Ann.
I was in belief that we have somewhat similar configuration for TS projects as well.

Hi Ann,
The issue was resolved post adding a new service connection.

Thanks

1 Like