Every so often, when you create a new scratch org and attempt certain actions:
- Log in.
- Switch to Lightning Experience.
- Deploy Lightning components via SFDX or the Metadata API.
you'll see an error related to My Domain. Upon login, it looks like this:
An error has occurred in the following section: [Exception, DomainNotPropagated]. Salesforce.com has been notified of this error.
presented in a plain, Classic-styled page.
These errors typically go away with a wait of less than five minutes, but waiting a few minutes by default doesn't cut it in a CI environment. So here's my question:
How do I detect this propagation issue from outside the org, i.e., by performing some DNS query? Or, alternately, how do I detect this propagation issue via the API, without mutating the state of the org?
What I've tried so far is primarily inspired by this Gist discussing how to solve a similar issue with Visualforce pages, but what I can't figure out is which domain, specifically, causes the issue, and whether I can actually detect it locally by running dig against domains like <mydomain>.my.salesforce.com or <mydomain>.lightning.force.com or <mydomain>--<mynamespace>.lightning.force.com. So far, I haven't been able to find a domain state that correlates with the presence of the error.
Because the issue is transitory and doesn't occur a majority of the time, it's very difficult to reproduce and get reliable data.