As a package developer scratch orgs look like a great solution for automated CI testing and Salesforce has even done some great demos using Github and TravisCI to show automatically testing code using the DX CLI. However, in reviewing the details of DX, it looks like the limit is currently set to 50 orgs a day. If we want to test pull requests against 5 different org configurations, this limits us to 10 test runs a day. On a moderately sized team, this is going to be a tough limit to deal with. Has anyone had any success in working around this limit (or heard of any planned limit increases in the future). My initial thoughts are:

  • Get Salesforce to increase the limit (does not seem likely since this is a very young feature)
  • Reuse scratch orgs for a period of time (this would require a good way to clean them and some savvy CI build code)
  • Run fewer tests (not going to go over well the first time a bug for a specific org configuration slips through)

1 Answer 1


The limits are discussed in the new winter release document here You can set the expiration time of scratch orgs that seems to be least resistance path on this.

enter image description here

Looks like for Unlimited its 200 and this is a substantial number .But I agree that with CI builds there is huge possibility of hitting this .

Here is what I am thinking in terms of using this for CI

The developer will create the scratch org and alias it .We can use the maximum time of the scratch org to set its expiration .Every developer will be strictly advised to set maximum time as 30 days thats the max.

sfdx force:org:create -f config/project-scratch-def.json  30

As a best practice we can set these to sprint duration .

Yes the limitation really makes me think that we should not be creating scratch orgs on every commit and instead have an environment variable for each git branch that has the scratch org alias or username for the flow .

  • Thanks for the suggestions, I'll see what it would take to set up and manage these build targets for CI (and also how we can clear an org so that different branches are not running into conflicts).
    – dsharrison
    Oct 18, 2017 at 18:13
  • When CI finishes, delete the scratch org with sfdx force:org:delete. I don't see a good reason why you couldn't create a scratch org with every commit if you are diligent about deleting them. Oct 20, 2017 at 3:32
  • 3
    @WadeWegner With bigger projects lets say you have 40 devs making commit all at the same time , they will consume all the daily limit of scratch org creation .In bigger projects highly possibility of making more than 100 commits a day and hitting the daily limit Oct 20, 2017 at 3:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .