Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
All errors
CLI · sf

My Domain is required for this org / Lightning components require My Domain to be deployed

Many Salesforce features (Lightning components, Connected Apps, single sign-on, Communities) require My Domain to be set up in the org. New scratch orgs and trials sometimes ship without it deployed. Setup → My Domain → Deploy.

Also seen asMy Domain is required·Lightning components require My Domain·My Domain not deployed

My Domain is the org's custom subdomain like acme.my.salesforce.com. Salesforce introduced it in 2014; required for all production orgs by Spring '24. Some development environments (scratch orgs, trials, fresh sandboxes) sometimes haven't deployed My Domain yet — and many features refuse to work without it.

What requires My Domain

  • Lightning components (LWC and Aura) — Lightning App Builder, custom components
  • Connected Apps — OAuth flows, JWT, anything outside login.salesforce.com
  • Single sign-on (SAML, OAuth)
  • Communities / Experience Cloud sites
  • Custom domains and SSL certificates
  • API access from external apps in some configurations

If your code uses any of these, the deploy may fail before even running tests.

Set up My Domain

Via UI

Setup → My Domain → Choose Your Domain Name → register a name → wait for activation (a few minutes) → Deploy to Users.

After deploy, the org is reachable at <yourname>.my.salesforce.com. The old na189.salesforce.com URLs redirect there for ~90 days.

Via metadata API

In your project's force-app/main/default/settings/MyDomainSettings.settings-meta.xml:

<MyDomainSettings xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableLogoutToCurrentDomain>true</enableLogoutToCurrentDomain>
    <enableMyDomainInstancedCNames>false</enableMyDomainInstancedCNames>
    <hstsOnForcedotComSites>true</hstsOnForcedotComSites>
    <removeInstanceNamesFromUrls>true</removeInstanceNamesFromUrls>
    <useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
</MyDomainSettings>

Deploy this with your other metadata to enable My Domain features programmatically. (For new orgs, the actual subdomain is set elsewhere; this just configures behavior.)

In a scratch org definition file

{
  "orgName": "MyScratchOrg",
  "edition": "Developer",
  "features": ["MultiCurrency", "MyDomainAvailable"],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    },
    "mobileSettings": {
      "enableS1EncryptedStoragePref2": true
    }
  }
}

The MyDomainAvailable feature in scratch orgs auto-enables My Domain. New scratch orgs created with this definition won't hit the error.

A common diagnostic

Try logging into the org. Does the URL contain .my.salesforce.com (instead of na189.salesforce.com)? If yes, My Domain is deployed. If no, it isn't.

Also check Setup → My Domain. The status section shows "Active" / "Pending Deployment" / "Not Configured".

Migration from non-My-Domain

If you've maintained an old org that survived without My Domain (rare in 2026), turning it on changes URLs for users. Plan a maintenance window:

  1. Pre-announce the change to users
  2. Deploy to a few users via Profile assignment
  3. Verify all integrations still work
  4. Deploy org-wide
  5. Update internal links + bookmarks

This is a 1-time pain. Once on My Domain, you stay there.

Related dictionary terms