cli icon indicating copy to clipboard operation
cli copied to clipboard

sfdx force:org:display is incorrectly showing a sandbox as a scratch org

Open azlam-abdulsalam opened this issue 3 years ago • 2 comments

Summary

Running sfdx force:org:display against a particular sandbox is displaying additional details, which should only be displayed for scratch orgs. This is resulting in some plugins such as sfdmu (https://github.com/forcedotcom/SFDX-Data-Move-Utility) preventing to connect to this org due to the 'Deleted' Connection status. I am only seeing this across only one of our sandboxes

I checked the username.json file in .sfdx folder and it is incorrectly having "devHubUsername" key, this inturn is causing the org display command to classify this sandbox in the scratch org group and show expiry details etc.

=== Org Description

 KEY             VALUE                                                                                                            
 ─────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
 Access Token    XXXX
 Alias           staging                                                                                                
 Client Id       PlatformCLI                                                                                                      
 Created By      integrationuser@<undisclosed>                                                                               
 Created Date    2021-04-09T18:19:32.000+0000                                                                                     
 Dev Hub Id      aabdulsalam@<undisclosed>                                                                                       
 Edition         Enterprise                                                                                                       
 Expiration Date 2021-04-11                                                                                                       
 Id              00D2O000000AjLkUAK                                                                                               
 Instance Url    https://<undisclosed>--staging.my.salesforce.com                                                                          
 Org Name        <undisclosed> Limited                                                                                                     
 Status          Deleted                                                                                                          
 Username        aabdulsalam@<undisclosed>.com.au.staging      

Steps To Reproduce:

Expected result

Should display the org with Expiration Date and the status should be connected

 KEY              VALUE                                                                                                            
 ──────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── 
 Access Token     XXX 
 Alias            staging                                                                                                   
 Client Id        PlatformCLI                                                                                                      
 Connected Status Connected                                                                                                        
 Id               00D2O000000AjLkUAK                                                                                               
 Instance Url     https://<undisclosed>--staging.my.salesforce.com                                                                          
 Username         aabdulsalam@<undisclosed>.com.au.staging

I went into .sfdx folder and removed the key 'devhubUserName' from the associated json file. The result was back to normal. Looks like somehow the auth fields are receiving devhubUserName flag

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.) zsh Version Info
{
  "cliVersion": "sfdx-cli/7.163.0",
  "architecture": "darwin-x64",
  "nodeVersion": "node-v18.2.0",
  "pluginVersions": [
    "@dxatscale/sfpowerscripts 18.9.0 (link) /Users/azlam.abdulsalam/projects/sfpowerscripts/packages/sfpowerscripts-cli",
    "@jayree/sfdx-plugin-prettier 1.1.0 (user)",
    "@oclif/plugin-autocomplete 1.3.0 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.12 (core)",
    "@oclif/plugin-not-found 2.3.1 (core)",
    "@oclif/plugin-plugins 2.1.0 (core)",
    "@oclif/plugin-update 3.0.0 (core)",
    "@oclif/plugin-version 1.1.1 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.4 (core)",
    "@oclif/plugin-which 2.1.0 (core)",
    "@rocko1204/packaging-helper 0.1.1 (user)",
    "alias 2.1.0 (core)",
    "apex 1.1.0 (core)",
    "auth 2.2.3 (core)",
    "community 2.0.0 (core)",
    "config 1.4.17 (core)",
    "custom-metadata 2.0.0 (core)",
    "data 2.1.1 (core)",
    "generator 2.0.2 (core)",
    "info 2.0.1 (core)",
    "limits 2.0.1 (core)",
    "org 2.0.7 (core)",
    "schema 2.1.1 (core)",
    "signups 1.2.0 (core)",
    "source 2.0.11 (core)",
    "telemetry 2.0.0 (core)",
    "templates 55.1.0 (core)",
    "trust 2.0.3 (core)",
    "user 2.1.0 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
    "apexlink 2.3.2 (user)",
    "salesforce-alm 54.7.1 (core)",
    "sfdmu 4.15.1 (user)",
    "sfdx-browserforce-plugin 2.6.3 (user)",
    "sfdx-hardis 2.90.0 (user)",
    "sfdx-jayree 4.0.3 (user)",
    "sfpowerkit 4.2.10 (link) /Users/azlam.abdulsalam/projects/sfpowerkit",
    "texei-sfdx-plugin 1.11.0 (user)"
  ],
  "osVersion": "Darwin 21.6.0"
}

Additional information

Feel free to attach a screenshot.

azlam-abdulsalam avatar Aug 15 '22 06:08 azlam-abdulsalam

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.

github-actions[bot] avatar Aug 15 '22 06:08 github-actions[bot]

@azlam-abdulsalam thanks for filing the issue. Are you able to provide steps to reproduce the problem?

mdonnalley avatar Aug 15 '22 16:08 mdonnalley

@mdonnalley This happens only on one particular sandbox. So I am not sure about the reproduction steps.

That being said, I figured this only happens if the devhub is authenticated before authenticating to the sandbox. If the sandbox is authenticated before production, the error disappears

azlam-abdulsalam avatar Aug 18 '22 05:08 azlam-abdulsalam

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Sep 30 '22 02:09 github-actions[bot]

Hey @azlam-abdulsalam sorry for the late reply

I'm not able to repro this with sfdx-cli/7.170.0 , what command are you using to authenticate to that sbx? It might be related to this bug: https://github.com/forcedotcom/cli/issues/1718#issuecomment-1262718041

cristiand391 avatar Sep 30 '22 14:09 cristiand391

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Oct 08 '22 02:10 github-actions[bot]