Travis CI fails to create a scratch org

This has also been reported on the success community and we are currently looking into the issue. Some things to note:

  1. The CLI uses the streaming API (long polling) to be notified when the scratch org is created. If the CLI doesn't get that message, then it will not try to authenticate to the org even if it has been created. We are adding a "last-ditch effort" on timeout to check if the org is created and will continue to auth if it is. The CLI will still wait the default time, but at least it will connect instead of timeout, so your CI runs may take a little more time. Here is the work item for reference. W-4795607
  2. As far as I'm aware, nothing has changed on the client or server to cause the streaming message from being sent to travis. Server and client logs look good. It is possible travis has made a change that is causing issues with long polling request, or other network latency issues causing the message to be lost. Although, if it was the latter I would imaging failures would be intermittent and we would see something on travis status page.

I'm not sure how you can debug this issue yourself. You can try to add --loglevel debug and look in the ~/.sfdx/sfdx.log but I would imagine all you will see is the CLI connecting to the streaming API and never getting a message. You could also try to manually connect to the streaming endpoint using faye on your machine, then run your CI job, and see if ANY message for that org is being sent over the streaming API at all.


As Amphro suggested in the comments of the previous answer, switching the build platform to osx fixes the problem. Our working .travis.yml setup looks as follows:

sudo: true
os:
  - osx
language: node_js
node_js:
  - "8"
before_install:
  - npm i -g sfdx-cli
script:
  - ...

Notice that you need Node 8 for sfdx-cli (6 is the default on Travis osx).