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?
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.
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.
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?
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:
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?
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.
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?
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.
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.