Skip to content
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

sfdx org list bugs #1941

Closed
pogilvieCB opened this issue Feb 16, 2023 · 18 comments
Closed

sfdx org list bugs #1941

pogilvieCB opened this issue Feb 16, 2023 · 18 comments
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue

Comments

@pogilvieCB
Copy link

Summary

After upgrading to version 7.187 I'm hitting the following problem for what used to be force:org:list

  1. It no longer shows active scratch orgs
  2. it's showing expired scratch orgs in the list with DomainNotFoundError. These expired orgs cannot be cleanned out with the --clean option
  3. scratch org expiration dates are no longer shown

Short summary of what is going on or to provide context.

Steps To Reproduce:

  1. sfdx force:org:list OR org:list OR org. list

Repository to reproduce: dreamhouse-lwc
These are my private connected

  1. sfdx org:list --clean -p
     ALIAS           USERNAME                                 ORG ID             CONNECTED STATUS      
| ─── ─────────────── ──────────────────────────────────────── ────────────────── ───────────────────── 
|                     [email protected]               00D4W000008GlwGUAS Connected             
| (U)                 [email protected]                     00D6A000002G0qcUAC Connected             
|                     [email protected]            00D8I0000008cMEUAY DomainNotFoundError   
|                     [email protected]            00D7f0000009R2kEAE DomainNotFoundError   
|                     [email protected]            00D7f0000009QgYEAU                       
|                     [email protected]            00D8I0000008aUHUAY DomainNotFoundError   
|                     [email protected]            00D8I0000008cToUAI                       
|                     [email protected]            00DDH0000005Oq52AE DomainNotFoundError   
|                     [email protected]            00D3I0000000YzAUAU DomainNotFoundError   
|     b2b             [email protected]            00DDL00000CUJmY2AX DomainNotFoundError   
|     b2b-scratch-org [email protected]            00D7d000008qS1wEAE                       
|     cloud-staging   [email protected]       00D8C0000008hfvUAA Connected             
|     common          [email protected]            00D7e00000BKRCeEAP DomainNotFoundError   
|     cx              [email protected]               00D8A000000OeYkUAK Connected             
|     datamasker      [email protected]          00D030000004dy6EAA Connected             
|     demo1           [email protected]          00DDn000002GLe8MAG Connected             
|     demo2           [email protected]             00DDn000002nAkuMAE Connected             
|     devhub          [email protected]                 00D1U0000011dSDUAY Connected             
|     devops          [email protected]           00D8Z000000awxSUAQ Connected             
|     functions       [email protected]                 00D6S000001N57tUAC Connected             
|     jade            [email protected]           00D56000000Mgi1EAC Connected             
|     packaging       [email protected]                     00D1U0000011RWZUA2 Connected             
|     john           [email protected]                 00DP000000489PYMAY Connected             
|     retail          [email protected]                    00D6A000002G0qcUAC Connected             
|     staging         [email protected]             00D7f0000009NvCEAU Connected             
|     uat             [email protected]           00D6C0000000jROUAY Connected             
No active scratch orgs found. Specify --all to see all scratch orgs.

Expected result

     ALIAS           USERNAME                                 ORG ID             CONNECTED STATUS      
| ─── ─────────────── ──────────────────────────────────────── ────────────────── ───────────────────── 
|                     [email protected]               00D4W000008GlwGUAS Connected             
| (U)                 [email protected]                     00D6A000002G0qcUAC Connected             
|     cloud-staging   [email protected]       00D8C0000008hfvUAA Connected             
|     cx              [email protected]               00D8A000000OeYkUAK Connected             
|     datamasker      [email protected]          00D030000004dy6EAA Connected             
|     demo1           [email protected]          00DDn000002GLe8MAG Connected             
|     demo2           [email protected]             00DDn000002nAkuMAE Connected             
|     devhub          [email protected]                 00D1U0000011dSDUAY Connected             
|     devops          [email protected]           00D8Z000000awxSUAQ Connected             
|     functions       [email protected]                 00D6S000001N57tUAC Connected             
|     jade            [email protected]           00D56000000Mgi1EAC Connected             
|     packaging       [email protected]                     00D1U0000011RWZUA2 Connected             
|     john           [email protected]                 00DP000000489PYMAY Connected             
|     retail          [email protected]                    00D6A000002G0qcUAC Connected             
|     staging         [email protected]             00D7f0000009NvCEAU Connected             
|     uat             [email protected]           00D6C0000000jROUAY Connected             
scratch orgs found. 
|     b2b-scratch-org [email protected]            00D7d000008qS1wEAE         <--- with an expiration date              

Actual result

Describe what actually happened.

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)

  • If you are using sfdx
    Projects/salesforce/salesforce-codescan > sfdx --version salesforce-codescan (master)
    sfdx-cli/7.187.1 darwin-x64 node-v18.13.0

  • If you are using sf
    no but sf org list produces the same result.

  • Paste the output here

Additional information

Projects/salesforce/salesforce-codescan > uname -a salesforce-codescan (master)
Darwin T9RXD334KM 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64

Feel free to attach a screenshot.

@pogilvieCB pogilvieCB added the investigating We're actively investigating this issue label Feb 16, 2023
@github-actions
Copy link

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.

@mshanemc
Copy link
Contributor

I'm not able to replicate that issue. Can you run sfdx version --verbose like the template suggested, so I can see the plugins versions?

There's something weird about your auth files for those scratch orgs. If you run cat ~/.sfdx/[email protected] (but use one of your scratch orgs) does is resemble this?

In particular, is there a devHubUsername and are you still connected to that DevHub?

{
  "accessToken": "long encrypted string",
  "instanceUrl": "https://pluto-noodles-6043-dev-ed.scratch.my.salesforce.com",
  "orgId": "00DDK000000HLlk2AG",
  "username": "[email protected]",
  "loginUrl": "https://CS244.salesforce.com",
  "refreshToken": "long encrypted string",
  "clientId": "PlatformCLI",
  "isDevHub": false,
  "devHubUsername": "[email protected]",
  "created": "1673134705000",
  "expirationDate": "2023-01-14",
  "createdOrgInstance": "CS244",
  "snapshot": null,
  "instanceApiVersion": "56.0",
  "instanceApiVersionLastRetrieved": "1/13/2023, 2:44:07 PM",
  "tracksSource": true,
  "userId": "005DK000005LaF4YAK",
  "password": "long encrypted string"
}%   

@mshanemc mshanemc added the more information required Issue requires more information or a response from the customer label Feb 16, 2023
@pogilvieCB
Copy link
Author

sorry @mshanemc I missed that.

Projects/salesforce/salesforce-codescan > sfdx version --verbose                                                         salesforce-codescan (master)
 CLI Version:
	sfdx-cli/7.187.1

 Architecture:
	darwin-x64

 Node Version:
	node-v18.13.0

 Plugin Version:
	@dxatscale/sfp-cli 3.1.1 (user)
	@dxatscale/sfpowerscripts 20.20.3 (user)
	@oclif/plugin-autocomplete 1.4.4 (core)
	@oclif/plugin-commands 2.2.5 (core)
	@oclif/plugin-help 5.1.12 (user)
	@oclif/plugin-not-found 2.3.17 (core)
	@oclif/plugin-plugins 2.3.0 (core)
	@oclif/plugin-search 0.0.11 (core)
	@oclif/plugin-update 3.1.1 (core)
	@oclif/plugin-version 1.2.1 (core)
	@oclif/plugin-warn-if-update-available 1.7.3 (user)
	@oclif/plugin-which 2.2.12 (core)
	@pogilvie/sfdx 0.0.6 (link) /Users/peter/Projects/personal/sfdx
	alias 2.2.0 (core)
	apex 1.5.0 (core)
	auth 2.4.0 (core)
	community 2.2.0 (core)
	config 1.5.0 (core)
	custom-metadata 2.1.0 (core)
	data 2.2.0 (core)
	generator 2.0.17 (core)
	info 2.4.0 (core)
	limits 2.3.0 (core)
	org 2.3.0 (core)
	packaging 1.14.1 (core)
	schema 2.3.0 (core)
	signups 1.4.0 (core)
	source 2.4.1 (core)
	telemetry 2.1.0 (core)
	templates 55.3.0 (core)
	trust 2.4.0 (core)
	user 2.3.0 (core)
	@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)
	@salesforce/sfdx-scanner 3.9.0 (user)
	case 0.0.0 (link) /Users/peter/Projects/coinbase/case
	salesforce-alm 54.8.5 (core)
	sfdmu 4.26.5 (user)
	sfpowerkit 6.1.0 (user)

 OS and Version:
	Darwin 22.3.0

 Shell:
	zsh

 Root Path:
	/Users/peter/.local/share/sfdx/client/7.187.1-09910f2

@mshanemc
Copy link
Contributor

are there any differences in those orgs' authFiles?

@pogilvieCB
Copy link
Author

Obviously I can't post them here but I'm not seeing anything different with them.

@pogilvieCB
Copy link
Author

Yes, I'm still connected to the devhub

@mshanemc
Copy link
Contributor

Is there anything special about those scratch orgs? Are they really old?

If you create an org, and then delete it, does it also show up in that first section, with a connection error?

@petter-eikeland
Copy link

petter-eikeland commented Feb 20, 2023

@pogilvieCB @mshanemc I experience the same issue, however I believe this is related to the sfpowerscripts plugin. With sfpowerscripts we create the scratch orgs the night before and fetch them the next day. Thus, sfpowerscripts generates the auth files for the scratch orgs (or provides the ones created at midnight?), unlike a regular sfdx org create.

An example auth file for sfpowerscripts:

{
  "orgId": "00DMd000000MO6vMAG",
  "username": "[email protected]",
  "accessToken": "long encrypted string",
  "instanceUrl": "https://connect-customization-2422.my.salesforce.com",
  "loginUrl": "https://connect-customization-2422.my.salesforce.com",
  "refreshToken": "long encrypted string",
  "clientId": "PlatformCLI",
  "isDevHub": false,
  "devHubUsername": "[email protected]",
  "instanceApiVersion": "57.0",
  "instanceApiVersionLastRetrieved": "2/20/2023, 2:03:47 PM",
  "name": "Client",
  "instanceName": "DEU50S",
  "namespacePrefix": null,
  "isSandbox": false,
  "isScratch": true,
  "trailExpirationDate": "2023-03-03T01:06:05.000+0000",
  "tracksSource": true
}

So if the auth file structure & content have been updated in the 7.187+ sfdx versions, I assume that @pogilvieCB local sfdx version does not recognize "old" auth file structures generated by sfpowerscripts?

@azlam-abdulsalam
Copy link

@mshanemc sfpowerscripts utilities 3.33.1 of @salesforce/core and follows similar code to cli

https://github.com/dxatscale/sfpowerscripts/blob/f78ee35a1a081068acafa9e0e1affcae4155c4ca/packages/core/src/scratchorg/pool/PoolFetchImpl.ts#L214

Do you see any issues?

@mshanemc
Copy link
Contributor

mshanemc commented Feb 22, 2023

@azlam-abdulsalam I don't see anything obvious there.

The org:list command is using this code to read all the auth files and determine if something is a scratch org or not https://github.com/salesforcecli/plugin-org/blob/f28fd65720ff71428312c35ba8413259cc969838/src/shared/orgListUtil.ts#L185.

Any chance your plugin is touching the expiration date property, possibly unsetting it? Does it modify auth files?

@MikhailShumenko
Copy link

So, how to solve this issue? I'm not able to work with SFDX in my IDE (JetForcer plugin for IntelliJ IDEA)

@jeffhube
Copy link

What's missing is the expirationDate property.

It's not set when authorizing a scratch org with sfdx auth:sfdxurl:store (implementation here), nor when authorizing a scratch org with sfdx sfpowerscripts:pool:fetch which also uses an auth url (implementation here).

If it matters, I did run sfdx auth:sfdxurl:store with a file containing only the auth url, instead of the whole JSON output from sfdx force:org:display --verbose --json. sfdx sfpowerscripts:pool:fetch would also be working with only the auth url.

@petter-eikeland
Copy link

Yeah, that makes sense. I've had the same issue with sfdxurl:store for some time

@peternhale peternhale added bug Issue or pull request that identifies or fixes a bug and removed more information required Issue requires more information or a response from the customer labels Feb 24, 2023
@git2gus
Copy link

git2gus bot commented Feb 24, 2023

This issue has been linked to a new work item: W-12599257

@cristiand391
Copy link
Member

Hey all 👋🏼, this should be fixed in the latest-rc (sfdx v7.194.1) if someone wants to test it:
• Update with npm: npm install -g sfdx-cli@latest-rc
• Update with Installer: sfdx update stable-rc (run sfdx update stable to rollback)

@petter-eikeland
Copy link

@cristiand391 Thanks for the update.

I tested using only the sfdxAuthUrl parameter and it seems like the issue is fixed for me at least!

{
  "result": {
    "sfdxAuthUrl": "force://PlatformCLI::[email protected]"
  }
}

@cristiand391
Copy link
Member

fixed in sfdx v7.194.1..
Release notes: https://github.com/forcedotcom/cli/blob/main/releasenotes/sfdx/README.md#71940-march-30-2023-stable

@pogilvieCB
Copy link
Author

@cristiand391 We upgraded to 194 yesterday and have verified that the fix is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

8 participants