there is a known issue SFDX- when using in JENKINS :sfdx force:apex:test:run: An ERROR: Unable to invoke async test job: Subscriber handshake failed due to a socket timeout on trailblazer site with no workaround specified.

i wanted to share my one, hopefully it'll help someone else.

1 Answer 1


it looks like the core reason for that error is SFDC "forgets" to which instances it's connected. at least my setup started to show me the error in 2-3 weeks of night builds.

i do not use pipeline, but a freestyle project in Jenlinks. so my workaround is to run

sfdx force:org:list

before any

sfdx force:apex:test:run

it seems, in case of Pipeline the code should be the following:

command "${toolbelt}/sfdx force:org:list"

i'd add that command as the first line to "Authorize DevHub" stage of that Jenkinsfile Walkthrough. in my case, that issue does not return for 3-4 months already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.