-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth'ing a Scratch org before any other org causes it to be a "Non-scratch org" #2288
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
@cromwellryan repeat your tests adding an custom expiration date when creating this SO. After reading the following lines of code my guess is that the default expiration date isn't stored in the local cache when creating the first SO. https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts#L670-L687 https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts#L563-L577 https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts#L620-L635 https://github.com/forcedotcom/sfdx-core/blob/main/src/org/org.ts#L666-L687 |
Maybe this would actually happen with all SOs added using the auth url? Could you add 2 SOs in sequence and verify that both aren't considered SOs. |
That's an atypical flow. Scratch orgs rely on devhubs since that's the only way they are created so the auth is pretty tightly coupled with devhub orgs. Your flow would work if you authed (or re-authed) to the devhub org before re-authing to the scratch org because of this code: https://github.com/forcedotcom/sfdx-core/blob/main/src/org/authInfo.ts#L389 We can look into improving detection when the auth file already exists but until then I would auth to the devhub before the scratch org and that should allow your flow to work. |
Some folks on stackoverflow say it is possible to use the tooling api to query the |
Or u could maybe add |
note: [with enhanced domains turned on] the instance url of a scratch org ends with |
We can check these things as part of detection but they tend to be unreliable and change without warning, especially URLs. Without the devhub auth file there will almost certainly be problems with other commands too, like trying to delete that scratch org or doing most packaging commands. |
export the whole org information as base64. The person who created the org will for sure have the information if it is or not a SO, because the type is specified as an input when creating it. I'm suggesting you to change the sfdx auth url to be a base64 to make it easier for us to pipe the exported data into sfdx auth in the future, as I suggested here
flags could overwrite the information contained within the decoded base64 so that developers could change, for example, the alias of the newly imported org. You could even allow people to include the DevHub info in this exported base64. This way devs can import both at the same time with a single command. This can be achieved with an additional flag under the To export the org, you could maybe create a new commands under
you could also add an optional key flag which allows people to encrypt the exported org information. |
I've looked at a couple ways to do this (ex: when you auth to a new org that is a devHub, ask it if it knows if any non-scratch orgs might actually be its children) and the juice:squeeze ratio is off given
Eventually, when we get enhancedDomains on by default for scratch orgs like they are for sandboxes and it becomes more obvious by its instanceUrl, then we could do something smarter. |
Im going to fix this and earn my oscar and the oscar goes to... |
Summary
If a scratch org is auth'ed (via auth url) as the very first Org, it will appear as a Non-Scratch org (in
org list
). Even after auth'ing other non-scratch orgs.Steps To Reproduce
sfdx org display --target-org [email protected] --verbose --json | jq -r .result.sfdxAuthUrl > auth.file
sfdx org logout --all
sfdx org login sfdx-url --sfdx-url-file auth.file -d -s --alias my-scratch-org
sfdx org login web
Expected: Org shows as a Scratch Org
Actual: Org shows as a Non-Scratch Org
System Information
The text was updated successfully, but these errors were encountered: