3

I'm trying to set up a Heroku Pipeline for Salesforce DX as described in this example: https://github.com/wadewegner/salesforce-dx-pipeline-mdapi-sample.

The process works fine up until a pull request is created and the review app is created (Heroku runs a script which authenticates to my Dev Hub, creates a new Scratch org, and pushes the branch to it)

The Heroku log shows that the Scratch Org has been created:

Successfully created scratch org: 00D3D0000000o2bUAA, username: test-tjcuvjdzxnig@example.com

The Scratch org is also visible in my Dev Hub UI: enter image description here

However, the Scratch Org is never listed when running the Salesforce DX CLI sfdx force:org:list command. The command will list all other orgs I've authenticated in the CLI, as well as Scratch Orgs created directly in the CLI, but never Scratch Orgs created from Heroku. Likewise the sfdx force:org:open command also fails with the new scratch org username:

sfdx force:org:open -u test-tjcuvjdzxnig@example.com
ERROR: No org configuration found for name test-tjcuvjdzxnig@example.com. 

Consequently, I cannot actually log into the review app Scratch Org. Have I overlooked something here? Appreciate any help!

5

You are not overlooking anything but you are not understanding few concepts on how authentication works between CLI and Salesforce.

The machine that creates the scratch can log into that using sfdx force:org:open .Since you never created the org from your local machine this wont show up .

Here is what you can do if you want to log into the scratch org .First reset the password or create another user in your scratch org that you have password with .

Then run the login command as below to authenticate and set alias once login

sfdx force:auth:web:login --setalias myScratchOrg

On successful auth set as default as below

sfdx force:config:set defaultusername=myScratchOrg

Now open it using sfdx force:org:open -u myScratchOrg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.