SFDO-Tooling / CumulusCI

Python framework for building portable automation for Salesforce projects

Home Page:http://cumulusci.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`cci org remove` doesn't remove org

joeythomaschaske opened this issue · comments

Describe the bug

I deleted a scratch org through the sf cli and am now attempting to remove it from cci by running cci org remove qa which errors and does not remove the org

% cci org remove qa    
A scratch org was already created, attempting to delete...
[01/23/24 09:11:33] Deleting scratch org with command: sfdx force:org:delete -p -u test-vh9md8lshlzf@example.com                                                                                                                                       
[01/23/24 09:11:34] (node:11740) Warning: Deprecated environment variable: SFDX_DISABLE_TELEMETRY. Please use SF_DISABLE_TELEMETRY instead.                                                                                                            
                                                                                                                                                                                                                                                       
                    (Use `node --trace-warnings ...` to show where the warning was created)                                                                                                                                                            
                                                                                                                                                                                                                                                       
                    Warning: The force:org:delete command is deprecated. Try "org delete scratch" or "org delete sandbox" instead.                                                                                                                     
                                                                                                                                                                                                                                                       
                    Warning: The "-u" flag has been deprecated. Use "--target-org | -o" instead.                                                                                                                                                       
                                                                                                                                                                                                                                                       
                    Error (1): No authorization information found for test-vh9md8lshlzf@example.com.                                                                                                                                                   
                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                       
Failed to delete scratch org
Perhaps it was already deleted?
Removing org regardless.
Error: Could not find org named qa to delete.  Deleting in project org mode.  Is qa a global org?

Run cci org list and it still shows

% cci org list                
                                          Scratch Orgs                                                                                                                                                                                                 
                                                                                                                                                                                                                                                       
  Default   Name             Days   Expired   Config           Domain                                                                                                                                                                                  
 ───────────────────────────────────────────────────────────────────────────────────────────────                                                                                                                                                       
            beta             1                beta                                                                                                                                                                                                     
            dev              30     ✔         dev                                                                                                                                                                                                      
            dev_namespaced   30               dev_namespaced                                                                                                                                                                                           
            enterprise       1                enterprise                                                                                                                                                                                               
            feature          1                feature                                                                                                                                                                                                  
            packaging        1                packaging                                                                                                                                                                                                
            qa               1/7              qa               customer-java-210-dev-ed.scratch                                                                                                                                                        
            qa2              1                qa2                                                                                                                                                                                                      
            release          1                release 

Attempting to recreate this org with cci flow run qa_org --org qa fails because cci thinks the org still exists

% cci flow run qa_org --org qa
[01/23/24 09:16:21] ============================================================                                                                                                                                                                       
                    Initializing flow: FlowCoordinator (qa_org)                                                                                                                                                                                        
                    Set up an org as a QA environment for unmanaged metadata                                                                                                                                                                           
                    ============================================================                                                                                                                                                                       
                                                                                                                                                                                                                                                       
                    Verifying and refreshing credentials for the specified org: qa.                                                                                                                                                                    
                    Getting org info from Salesforce CLI for test-vh9md8lshlzf@example.com                                                                                                                                                             
[01/23/24 09:16:23] Return code: 2                                                                                                                                                                                                                     
                    (node:12409) Warning: Deprecated environment variable: SFDX_DISABLE_TELEMETRY. Please use SF_DISABLE_TELEMETRY instead.                                                                                                            
                    (Use `node --trace-warnings ...` to show where the warning was created)                                                                                                                                                            
                    {                                                                                                                                                                                                                                  
                    "code": 2,                                                                                                                                                                                                                         
                    "context": "OrgDisplayCommand",                                                                                                                                                                                                    
                    "commandName": "OrgDisplayCommand",                                                                                                                                                                                                
                    "message": "Parsing --target-org \n\tNo authorization information found for test-vh9md8lshlzf@example.com.\nSee more help with --help",                                                                                            
                    "name": "NamedOrgNotFoundError",                                                                                                                                                                                                   
                    "status": 2,                                                                                                                                                                                                                       
                    "stack": "NamedOrgNotFoundError: Parsing --target-org \n\tNo authorization information found for test-vh9md8lshlzf@example.com.\nSee more help with --help\n    at Messages.createError                                            
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/messages.js:408:16)\n    at AuthInfo.init                                                                                      
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/org/authInfo.js:602:28)\n    at async AuthInfo.create                                                                          
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/kit/lib/creatable.js:57:9)\n    at async Org.init                                                                                       
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/org/org.js:784:27)\n    at async Org.create                                                                                    
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/kit/lib/creatable.js:57:9)\n    at async maybeGetOrg                                                                                    
                    (file:///Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/sf-plugins-core/lib/flags/orgFlags.js:13:16)\n    at async getOrgOrThrow                                                         
                    (file:///Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/sf-plugins-core/lib/flags/orgFlags.js:46:17)\n    at async parseFlagOrThrowError                                                 
                    (/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@oclif/core/lib/parser/parse.js:271:24)\n    at async                                                                                               
                    /Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@oclif/core/lib/parser/parse.js:407:88\n    at async Promise.all (index 1)",                                                                         
                    "exitCode": 2,                                                                                                                                                                                                                     
                    "warnings": [                                                                                                                                                                                                                      
                    "The \"force org display\" command has been deprecated. Use \"org display\" instead."                                                                                                                                              
                    ]                                                                                                                                                                                                                                  
                    }                                                                                                                                                                                                                                  

Error: 
stderr:
(node:12409) Warning: Deprecated environment variable: SFDX_DISABLE_TELEMETRY. Please use SF_DISABLE_TELEMETRY instead.
(Use `node --trace-warnings ...` to show where the warning was created)
stdout:
{
"code": 2,
"context": "OrgDisplayCommand",
"commandName": "OrgDisplayCommand",
"message": "Parsing --target-org \n\tNo authorization information found for test-vh9md8lshlzf@example.com.\nSee more help with --help",
"name": "NamedOrgNotFoundError",
"status": 2,
"stack": "NamedOrgNotFoundError: Parsing --target-org \n\tNo authorization information found for test-vh9md8lshlzf@example.com.\nSee more help with --help\n    at Messages.createError 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/messages.js:408:16)\n    at AuthInfo.init 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/org/authInfo.js:602:28)\n    at async AuthInfo.create 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/kit/lib/creatable.js:57:9)\n    at async Org.init 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/core/lib/org/org.js:784:27)\n    at async Org.create 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/kit/lib/creatable.js:57:9)\n    at async maybeGetOrg 
(file:///Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/sf-plugins-core/lib/flags/orgFlags.js:13:16)\n    at async getOrgOrThrow 
(file:///Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@salesforce/sf-plugins-core/lib/flags/orgFlags.js:46:17)\n    at async parseFlagOrThrowError 
(/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@oclif/core/lib/parser/parse.js:271:24)\n    at async 
/Users/User/.local/share/sf/client/2.24.4-c9898a2/node_modules/@oclif/core/lib/parser/parse.js:407:88\n    at async Promise.all (index 1)",
"exitCode": 2,
"warnings": [
"The \"force org display\" command has been deprecated. Use \"org display\" instead."
]
}

Reproduction steps

  1. create an org via the qa_org flow
  2. delete the org through the sf cli
  3. Try to remove the org through cci with cci org remove
  4. Try to create a new org with the qa_org flow

Your CumulusCI and Python versions

CumulusCI version: 3.83.0 (/Users/User/.local/bin/cci)
Python version: 3.11.4 (/Users/User/.local/pipx/venvs/cumulusci/bin/python)

Operating System

Mac OS 14.1.1

Windows environment

No response

CumulusCI installation method

pipx

Error Gist

https://gist.github.com/joeythomaschaske/58f6f938a69fa1eeb0297b0ca36551b1

Additional information

No response

In the mean time I was able to get around it by removing the org definition, qa.org from Users/User/.cumulusci/<project-name>

Thanks for the report, we'll take a look at ways to make this command more robust.