Getting Error while creating scratch Org, how to resolve it?

661    Asked by ChloeBurgess in Salesforce , Asked on Aug 5, 2021

When I was trying to create a scratch org and get stuck in the following section Create and Test Our Scratch Org - Step 2

https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/create-and-test-our-scratch-org?trail_id=sfdx_get_started 

while executing the following command getting the following error.

sfdx force:org:create -s -f config/project-scratch-def.json -a dreamhouse-org

ERROR running force:org:create: Must pass a username and/or OAuth options when creating an AuthInfo instance. 

Steps Executed

  1. Created Project in VSCode
  2. Authorized an Org
  3. Executed Trailhead steps as mentioned in the  link
Answered by Keiko Kanda

You have to login first and authorize your Dev Hub on the same folder directory where you will create your scratch def org.


            sfdx force:auth:web:login -d -a DevHub

This is in the prior step, you can't work on them separately.

            VSCodeQuickstartmy_sfdx_projectdreamhouse-sfdx$ sfdx force:auth:web:login -d -a DevHub VSCodeQuickstartmy_sfdx_projectdreamhouse-sfdx$ sfdx force:org:create -s -f config/project-scratch-def.json -a dreamhouse-org

Scratch def org: The scratch def org is a source-driven and disposable deployment of Salesforce code and metadata. A scratch org is fully configurable, allowing developers to emulate different Salesforce editions with different features and preferences



Your Answer

Answer (1)

If you're encountering the error "Must pass a username and/or OAuth options when creating an AuthInfo instance" while creating a scratch org in Salesforce DX, ensure you first authorize your Dev Hub using sfdx force:auth:web:login -d -a DevHub in the correct project directory.  Openguessr

5 Days

Interviews

Parent Categories