question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

force:package:install --publishwait does not wait for package to become available

See original GitHub issue

Summary

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:

  1. Publish a new package version
  2. 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:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
clairebianchicommented, Nov 5, 2019

@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?

2reactions
sfdc-db-gmailcommented, Sep 27, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use the CLI to Install a Second-Generation Managed Package
The following command has publishwait set to six minutes and wait set to 10 minutes. If not already available, Expense Manager takes five...
Read more >
Error Running sfdx force:org:package commands
This is an issue reported on the GitHub repo for SFDX. The current solution is to install/downgrade to version 7.120.
Read more >
sfdx force:package:install | Fig - Fig.io
-b, --publishwait <publishwait>, Number of minutes to wait for subscriber package version ID to become available in the target org. -r, --noprompt, Do...
Read more >
Automating package installation - Fourth Edition
It is possible to automate package installation using the Salesforce DX CLI ... --publishwait 10 --wait 10 --targetusername test sfdx force:org:open -u test...
Read more >
Install package in salesforce using id. Generally, setuptools ...
You will be taken to the Package Installation Landing Page: Launch the Learning ... command. sfdx force:package:install --wait 10 --publishwait 10 --package ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found