forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

sfdx force:package:beta:delete -p <pkgid> will not delete a package if the packageAlias not in the sfdx-project.json file #1858

Closed RupertBarrow closed 1 year ago

RupertBarrow commented 1 year ago

Summary

Deleting a package with the sfdx force:package:beta:delete -p <0Ho pkgid> command will not work unless the related packageAlias defines an alias in the sfdx-project.json file. This seems ridiculous, since an alias is useful for finding an id, but not vice-versa.

Steps To Reproduce:

  1. Assume you have a 2GP package (unlocked in my case) with no package versions
  2. Assume you have a sfdx-project.json file with no packageAliases defined
  3. run the command sfdx force:package:beta:delete -v <devhub user> -n -p <0Ho package id>
  4. you will get an error message : "ERROR running force:package:beta:delete: Could not find an alias for the ID 0Ho..."
  5. update your sfdx-project.json file and add ``` "packageAliases": { "mypackage": "0Ho5p000000XZExCAO" }
  6. now run the delete command again sfdx force:package:beta:delete -v <devhub user> -n -p <0Ho package id>
  7. the package is deleted correctly : "Successfully deleted the package. 0Ho..."

Expected result

sfdx force:package:beta:delete -p <0Ho pkgid> should not require a packageAlias to be defined in sfdx-project.json if we are already passing it an 0Ho package id

Actual result

An error message is produced, requireing an alias be defined.

System Information

% sfdx version --verbose --json { "cliVersion": "sfdx-cli/7.182.1", "architecture": "darwin-x64", "nodeVersion": "node-v18.12.1", "pluginVersions": [ "@jayree/sfdx-plugin-legacy 1.1.16 (user)", "@jayree/sfdx-plugin-manifest 2.6.2 (user)", "@jayree/sfdx-plugin-prettier 1.2.16 (user)", "@mshanemc/plugin-streaming 1.1.7 (user)", "@mshanemc/sfdx-sosl 1.1.0 (user)", "@oclif/plugin-autocomplete 1.3.6 (core)", "@oclif/plugin-commands 2.2.1 (core)", "@oclif/plugin-help 5.1.19 (core)", "@oclif/plugin-not-found 2.3.9 (core)", "@oclif/plugin-plugins 2.1.8 (core)", "@oclif/plugin-search 0.0.4 (core)", "@oclif/plugin-update 3.0.7 (core)", "@oclif/plugin-version 1.1.3 (core)", "@oclif/plugin-warn-if-update-available 2.0.15 (core)", "@oclif/plugin-which 2.2.2 (core)", "@salesforce/lwc-dev-server 2.11.0 (user)", "alias 2.1.12 (core)", "apex 1.3.0 (core)", "auth 2.3.3 (core)", "community 2.0.18 (core)", "config 1.4.22 (core)", "custom-metadata 2.0.5 (core)", "data 2.1.17 (core)", "generator 2.0.13 (core)", "info 2.2.13 (core)", "limits 2.1.3 (core)", "org 2.2.19 (core)", "packaging 1.10.10 (core)", "schema 2.1.19 (core)", "signups 1.2.12 (core)", "source 2.3.8 (core)", "telemetry 2.0.5 (core)", "templates 55.1.0 (core)", "trust 2.2.2 (core)", "user 2.1.22 (core)", "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)", "@salesforce/sfdx-scanner 3.8.0 (user)", "salesforce-alm 54.8.4 (core)", "sfdmu 4.23.0 (user)", "sfdx-jayree 4.4.17 (user)", "sfpowerkit 6.0.1 (user)", "shane-sfdx-plugins 4.43.0 (user)" ], "osVersion": "Darwin 20.6.0", "shell": "zsh", "rootPath": "/Users/rupert/.local/share/sfdx/client/7.182.1-dad7ae3" }

Additional information

Feel free to attach a screenshot.

github-actions[bot] commented 1 year ago

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.

git2gus[bot] commented 1 year ago

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

WillieRuemmele commented 1 year ago

Thanks for raising this issue @RupertBarrow! fixed with https://github.com/forcedotcom/packaging/pull/179 🎉 and will be released in Thursday's RC