Azure DevOps: build artifact download error "Error: in getBuildApi, so retrying => retries pending : 4"

11.9k views Asked by At

I got this error when using the task 'Download Build Artifact' in the release pipeline of devops server 2019 or devops server 2020:

Error: in getBuildApi, so retrying => retries pending : 4

Detailed errors can be found when using diagnostic logging and / or by adding log statements to main.js in the agent\_work\_tasks\DownloadBuildArtifacts_a433f589-fce1-4460-9ee6-44a624aeb1fb directory:

Failed in getBuildApi with error: Error: unable to get local issuer certificate and

    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1092:38)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket._finishInit (_tls_wrap.js:609:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:439:38) code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'``` 
3

There are 3 answers

3
Thom Kiesewetter On

The problem was an certificate we used on our devops server which is not trusted by node. I think it has something to do with the root certificate because browsing to our devops server with chrome give no problems on the build agent. (The certificate is valid.)

To solve this issue set the following environment system variable and restart the agent services NODE_TLS_REJECT_UNAUTHORIZED=0

0
drpdrp On

I got this error with corporate proxy setup where DevOps server is running on premise on http, so no certificate errors could happen.

The problem was variable Agent.ProxyBypassList was not configured:

Agent.ProxyUrl=http://xxxx:8080
Agent.ProxyUsername=yyyyy
Agent.ProxyPassword=***
Agent.ProxyBypassList=undefined

The task DownloadBuildArtifacts@0 was unable to use the proxy even when other tasks like git checkouts, had no problem with the setup.

So, the fix that worked for us was to properly initialize variable Agent.ProxyBypassList for the build pipeline. It is a JSON array of url domains, so it should look like this:

Setting variable Agent.ProxyBypassList

Update:

Another solution where there is no need to add variables trought DevOps user interface is to set the environment variable directly on the pipeline task in YAML script:

- task: DownloadBuildArtifacts@0
  displayName: 'Download Artifacts'
  inputs:
    buildType: specific
    project: SomeProject
    pipeline: 123
    buildVersionToDownload: latestFromBranch
    branchName: $(Build.SourceBranch)
    artifactName: 'SomeArtifactName'
    downloadPath: 'TargetFolder'
  env:
    Agent_ProxyBypassList: '["mydevopsserver"]'
1
Ian Inchausti On

This is an old question, but the other option would be to download the certificate chain onto the machine and set the environment variable NODE_EXTRA_CA_CERTS to "/path/to/cert/file".