# Getting 'unable to verify leaf signature' error in VSTS prepare task

**URL:** <https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448>\
**Category:** SonarQube Server / Community Build\
**Tags:** azuredevops-services, ssl\
**Created:** [June 21, 2018, 10:29am UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448 "2018-06-21T10:29:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://community.sonarsource.com/u/Leo)\
**Post date:** [June 21, 2018, 10:29am UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/1 "2018-06-21T10:29:43Z")

</div>

Hi there,

We are using SonarQube with VSTS, and now we meet an issue, please see the followed picture for your reference:

 ![prepare](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/1X/b32b09a4be7bbfbf8bbc7f2a3d0f9736fb8ef3c5.jpg)

Please help us, thanks.

---

<div class="post-metadata">

**Author:** ![NicoB](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nicob/32/3_2.png) [@NicoB](https://community.sonarsource.com/u/NicoB)\
**Post date:** [June 21, 2018, 11:20am UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/2 "2018-06-21T11:20:42Z")

</div>

Hi Leo,

Looks like you’re hitting an error from the underlying Node.js framework that the VSTS task is based on. More information here: [https://developer.ibm.com/answers/questions/26698/unable-to-verify-leaf-signature-when-calling-rest-apis-from-node-js/](https://developer.ibm.com/answers/questions/26698/unable-to-verify-leaf-signature-when-calling-rest-apis-from-node-js/)

FYI you can leverage comments on [VSTS-147](https://jira.sonarsource.com/browse/VSTS-147) for hints on passing extra certificates if needed (though again this is a pure Node.js consideration).

---

<div class="post-metadata">

**Author:** ![fcavazos](https://avatars.discourse-cdn.com/v4/letter/f/d78d45/32.png) [@fcavazos](https://community.sonarsource.com/u/fcavazos)\
**Post date:** [September 18, 2018, 3:55pm UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/3 "2018-09-18T15:55:27Z")

</div>

Did you ever get a resolution for this? I’m encountering the same issue but with TFS on prem.

---

<div class="post-metadata">

**Author:** ![sopelt](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sopelt/32/8956_2.png) [@sopelt](https://community.sonarsource.com/u/sopelt)\
**Post date:** [January 24, 2020, 10:56am UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/4 "2020-01-24T10:56:44Z")

</div>

As stated by Nicolas this is caused by incomplete certificate chains. You have to ensure that the server terminating the SSL in front of your sonarqube returns potential intermediate certificates.  
You could use [https://www.ssllabs.com/ssltest](https://www.ssllabs.com/ssltest) to check if certificates are missing.

---

<div class="post-metadata">

**Author:** ![caza02](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@caza02](https://community.sonarsource.com/u/caza02)\
**Post date:** [January 30, 2020, 7:15am UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/5 "2020-01-30T07:15:34Z")

</div>

hello, when I want to replicate your steps I get this error “## [error] [SQ] API GET ‘/ api / server / version’ failed, the error was: {” code “:” UNABLE\_TO\_VERIFY\_LEAF\_SIGNATURE “}”, in step Prepare the analysis in SonarQube. Can you help me? Thank you

---

<div class="post-metadata">

**Author:** ![Edgar\_de\_Jesus\_Mendo](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/edgar_de_jesus_mendo/32/17060_2.png) [@Edgar\_de\_Jesus\_Mendo](https://community.sonarsource.com/u/Edgar_de_Jesus_Mendo)\
**Post date:** [May 18, 2021, 9:10pm UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/6 "2021-05-18T21:10:51Z")

</div>

Was anyone able to solve this problem?

---

<div class="post-metadata">

**Author:** ![michaels](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/michaels/32/17014_2.png) [@michaels](https://community.sonarsource.com/u/michaels)\
**Post date:** [June 9, 2021, 12:01pm UTC](https://community.sonarsource.com/t/getting-unable-to-verify-leaf-signature-error-in-vsts-prepare-task/448/7 "2021-06-09T12:01:06Z")

</div>

Since this is the latest reference I’ve found of this issue online i’ll write the solution that worked for me:

1. Make sure that the SSL termination on your SonarQube publishes a full chain from the SonarQube certificate to your root CA.
2. set NODE\_EXTRA\_CA\_CERTS to point to your root ca in a .pem format.  
This should suffice for the prepare analysis task to work properly.  
If you’re using the standalone scanner option in the run code analysis task make sure to add your root ca to your java keystore.
