force:package:install --publishwait does not wait for package to become available
See original GitHub issueSummary
We have a CI script which creates a new package and then directly installs it to an org. Often, this fails with the error:
ERROR: Encountered errors installing the package!,Installation errors:
1) Invalid Package, Details: This package is not yet available. Please try again later or contact the package owner.
This is despite our command using the force:package:install
command with --publishwait
argument
Steps To Reproduce:
- Publish a new package version
- Immediately attempt to install this package version in another org using
force:package:install --publishwait
Expected result
Package gets installed once it’s available to the org.
Actual result
Installation proceeds and then errors:
Waiting for the Subscriber Package Version ID to be published to the target org.
Waiting for the package install request to complete. Status = IN_PROGRESS
ERROR: Encountered errors installing the package!,Installation errors:
1) Invalid Package, Details: This package is not yet available. Please try again later or contact the package owner.
Additional information
This is already logged as a bug W-6015902 but I wanted to add it here to increase visibility and get an update on any fix.
When we run sfdx force:package:install
it polls the SubscriberPackageVersion
table:
SELECT Id, SubscriberPackageId FROM SubscriberPackageVersion WHERE Id='04t0000000000000000' AND InstallationKey ='null'
whilst displaying the message
Waiting for the Subscriber Package Version ID to be published to the target org.
When a record appears in this table, then the CLI thinks the package is available, and it starts installing:
Waiting for the package install request to complete. Status = IN_PROGRESS
But then fails pretty quickly with
ERROR: Encountered errors installing the package!,Installation errors: 1) Invalid Package, Details: This package is not yet available. Please try again later or contact the package owner.
When this happens, the InstallValidationStatus
is normally PACKAGE_UNAVAILABLE
. I think the CLI starts installing as soon as it finds a row in the SubscriberPackageVersion
table, instead of also checking the status of that row.
I think the --publishwait
argument should wait for the InstallValidationStatus
to become “NO_ERRORS_DETECTED
”, and then start installation.
SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.21.0 linux-x64 node-v12.9.0 › Warning: You acknowledge and agree that the CLI tool may collect usage › information, user environment, and crash reports for the purposes of › providing services or functions that are relevant to use of the CLI tool › and product improvements. @oclif/plugin-commands 1.2.3 (core) @oclif/plugin-help 2.2.1 (core) @oclif/plugin-not-found 1.2.3 (core) @oclif/plugin-plugins 1.7.8 (core) @oclif/plugin-update 1.3.9 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.0.5 (core) analytics 1.2.1 (core) generator 1.1.1 (core) salesforcedx 46.11.0 (core) ├─ force-language-services 46.15.0 (core) └─ salesforce-alm 46.14.0 (core)
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core) sfdx-cli 7.21.0 (core)
OS and version: https://github.com/salestrip/docker-sfdx-cli/blob/master/Dockerfile
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top GitHub Comments
@jamesmelville I am sorry to hear about your experience with support and our other channels for reporting issues. This repository is supported by the team that owns the CLI engine, we do not build all of the Force commands because we find it is best to have the experts in a given feature build the commands associated with that feature. This is why I passed your issue over the packaging team. I realize this is confusing and we are working internally to make this process better.
This channel also does not have an SLA and often takes a while because I am trying to find the right person/team to take a look at your issue.
I am going to reopen this issue here, so I have more visibility into it and can follow the progress. If you did open a case, please add the case number here and I will follow up with support myself.
@sfdc-db-gmail can you please review @jamesmelville comment above?
@jamesmelville - i believe this is fixed in v47 of CLI which is part of Winter '20 release. Please let us know if you are still experiencing this issue after Winter '20 rolls out over the next two weeks.