4

When creating a scratch org sfdx cli got timed out. Later on the scratch org was successfully created but the access token was not present in my sfdx cli.

I can see the scratch org info from the DevHub but how to access the scratch org if i do not have the password or token.

  • 2
    I'd just spin up a new scratch org. The one that timed out will expire after 7 days anyway. – David Reed Apr 28 '18 at 13:42
  • Can you open it from the command line using sfdx force:source:open? Do you have the url of the new scratch org? – Zack Walton Apr 30 '18 at 16:47
  • No the cli wasn't able to store the alias nor the url/security token. So, i have no information about the scratch org. The devhub shows that it was successfully created and is listed under active scratch orgs – Raja Paul May 1 '18 at 17:59
  • 1
    The answer I posted here salesforce.stackexchange.com/a/258231/2929 might also be useful in this scenario – James Apr 17 '19 at 21:54
2
> sfdx force:user:password:generate -u YourOrgAlias

Successfully set the password "password" for user test@example.com.
You can see the password again by running "sfdx force:user:display -u test@example.com".
| improve this answer | |
1

Scratch orgs are meant to be temporary, and inconsequential to spin up and/or delete. You can always spin up another if one didn't work correctly.

If you're the tidy type (not that there's anything wrong with that), you could always delete the one that failed to deliver the OAuth token through the Dev Hub UI Active Scratch Orgs tab. (It is a standard object and deletable.)

Delete Scratch Orgs

| improve this answer | |
  • That is true. But what if i have lost access to my scratch orgs because my machine was formatted or some other reason and i have some unfinished business with that scratch org. :p There should be some mechanism to access it. I tried forgot password with the username mentioned in DevHub , but no email is sent to my registered address – Raja Paul Apr 29 '18 at 8:38
0

If you committed your project to git and ensured that the .sfdx/ folder is included, you should see your org and config listed under the directory .sfdx/orgs

If so, you won't need the password. Simply set it as the default org for your project and you will be able to open and push/pull from it.

So execute this from within your project folder (after you find the org username using the method above):

sfdx force:config:set defaultusername=you@yourorg.com

Also see https://salesforce.stackexchange.com/a/236428/11055

| improve this answer | |
0

If a scratch org doesn't have password and it is disconnected from your sfdx cli workspace, you can't connect back to it. It is gone forever.

Always make sure to generate a password after you create a scratch org. That way you can connect to it from anywhere.

| improve this answer | |
-2

I used following command.

1. Authorise and set default user name with instance url.

sfdx force:auth:web:login --setdefaultdevhubusername --setalias Devxx --instanceurl https://CSxx.salesforce.com

2. config org user

sfdx force:config:set defaultusername=test-xxxxxxxx@example.com
| improve this answer | |

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.