-
Notifications
You must be signed in to change notification settings - Fork 79
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
Scratch org not listed in Scratch section when authenticated via JWT #949
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. |
I originally stated
However, that was the old behavior; now it appears that manually adding the "devHubUsername" key is the correct workaround. |
TLDR; it doesn't work the way that you are trying to use it. Scratch orgs stored locally are meant to be the result of the org:create command (we track them as scratch orgs associated with the dev hub that created them). If you auth into a scratch org any other way (web via username/password, auth_url, jwt) it's going to be treated as a non-scratch org. There's no good way to ask a scratch org for its devhub info, so we don't, by default, know where to go for that information. The workaround is as you described--manually setting the "stuff that makes it look like a scratch org" in the auth files. The most important is the dev hub--that's where |
This issue has been linked to a new work item: W-9073698 |
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. |
Thank you for filing this feature request. We appreciate your feedback and will review the feature at our next grooming or sprint planning session. We prioritize feature requests with more upvotes and comments. |
I logged this as a feature request, not a bug. |
@mshanemc Thanks for the explanation, that makes sense. I can say that in the past, |
@jclark-dot-org can you please try to run |
@jayree excellent! Workaround confirmed. Running the command did output as expected (I'm not currently using orgshape):
But the next run of |
Thanks @jayree and @jclark-dot-org , this is useful when you fetch scratch org from a pool! |
Agreed, this is useful and a topic of discussion among my team this morning. Much appreciated @jayree. |
Summary
We use a server-based automation (bitbucket pipelines) to create new scratch orgs, then authenticate from a dev's local machine to the new scratch using
auth:jwt:token
. When we do this, the scratch org is listed in the first (non-scratch) section offorce:org:list
, and expiration date info is not available.Steps To Reproduce:
NOTE you will need two systems with sfdx installed to reproduce this issue. It may be possible to fake this by doing all steps on one system, but deleting the org file from
~/.sfdx
after step 3, but I have not tested that scenario.sfdx auth:jwt:grant --clientid ${!CONSUMER_KEY} --jwtkeyfile ./server.key -r https://test.salesforce.com --username [email protected] -a bugreport
sfdx force:org:list
.Expected result
The new scratch org (alias
bugreport
) should be listed in the second section of output, as a scratch org, with an expiration date.Actual result
The new scratch org is listed in the first section. No expiration date information is available.
Additional information
This is NOT a duplicate of #845; creating a scratch and using it on the same system does not exhibit this issue.
This is actually behavior that has existed for quite a while, however, prior to a recent release (I think it changed in v54.4), running
force:org:display
for the new org would fix the issue, by updating the org file in~/.sfdx
. This is no longer the case.If you compare org files in
~/.sfdx
, comparing a scratch created on the local system with a JWT-auth'd scratch created elsewhere, you can see the the JWT version is missing the keyscreatedOrgInstance
,created
, andexpirationDate
. Manually adding theexpirationDate
key to the file with a reasonable value is sufficient to makeforce:org:list
display the org as a scratch org.SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
OS and version:
macOS version 10.14.6
The text was updated successfully, but these errors were encountered: