Salesforce CLI – SFDX – Cannot read properties of undefined (reading ‘id’)

Reading Time: < 1 minutes
When running the command that makes the login against our Sandbox org, it redirects to a localhost URL and then it display an error that doesn’t give us so much information
      sfdx auth:web:login -a myuser@abc.com --instanceurl=https://xxxxx--xxxxx.my.salesforce.com
    

The error

Cannot read properties of undefined (reading ‘id’)
This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.
This error can be related to the enhanced domain enabled or just the wrong URL typed in the login command. Read more about
Enhanced Domain enabled https://help.salesforce.com/s/articleView?id=sf.domain_name_enhanced_enable.htm&type=5

Solution

To fix this error, add just “sandbox” to the URL so the pattern must be “xxxxxx–xxxx.sandbox.my.salesforce.com”

      sfdx auth:web:login -a myuser@abc.com --instanceurl=https://xxxxxx--xxxx.sandbox.my.salesforce.com
    
Photo by Markus Spiske on Unsplash
,

About the author

Andrés Canavesi
Andrés Canavesi

Software Engineer with 15+ experience in software development, specialized in Salesforce, Java and Node.js.


Related posts


Leave a Reply

%d bloggers like this: