I'm trying to install managed packages into a new scratch org. I've found that certain packages fail to install because they depend on other managed packages (e.g. the "TaskRay Lightning Components" package requires the "Taskray" package). I'd like to create a process that will work generally without knowing the dependencies beforehand.
I found this sample script that demonstrates querying the `SubscriberPackageVersion` to get a list of dependencies, but when I do so, none of the installed packages have any values in the `Dependencies` field, including "TaskRay Lightning Components". The error mesage is `A required package is missing, Details: Package "TaskRay", Version 1.934 or later must be installed first.`. Seems like there should be a dependency to be found. Not only that, it succeeds after first installing "TaskRay" as described.
Why am I not seeing this dependency when I query SubscriberPackageVersion as shown in the sample script? Any ideas? @Salesforce DX
@Anthony Giuliano, You are correct and I was wrong on my earlier comment. I was not aware that the dependency information in SubscriberPackageVersion is not restricted to just the packages owned by the DevHub you are querying. I was aware of the script and the approach that you reference in your last comment. I was just under the belief that it was restricted to the packages owned by the DevHub. After doing some of my own research now, that is clearly not the case. Very interesting and my apologies for incorrect statement earlier.
I did some research just now and did find something interesting that may explain what you are seeing. Do you know if "TaskRay Lightning Components" is a 1st Generation Package (1GP) or a 2nd Generation Package (2GP)?? If it is a 1GP, then that may explain the issue.
I checked a 1GP that I know for certain has a dependency on another 1GP. When I check the SubscriberPackageVersion of the 1GP, the dependency section of the query comes back null. This makes sense to me as the explicit act of specifying dependencies on packages did not come about until the 2GP feature were released. If "TaskRay Lightning Components 1GP" depends on "TaskRay 1GP", then the SubscriberPackageVersion info on TaskRay LC will probably come back null.
Having said that, you probably only need to find the "04t" on the TaskRay 1GP and then add that TaskRay 1GP, along with the "04t" of "TaskRay Lightning Components" 1GP, to your own project's sfdx-project.json dependency list. It is my understanding that, during the packaging phase of your project, Salesforce is only aware of the package dependencies that you explicitly specify in your sfdx-project.json. I am not aware of them incorporating "other non-specified, upstream dependencies" into the packaging build. So, you will have to specify that TaskRay 1GP dependency along with the "TaskRay Lightning Components" 1GP dependency regardless. The good news then becomes that, when you query SubscriberPackageVersion for your project's package version "04t", it will list all dependencies including "TaskRay Lightning Components" 1GP and "TaskRay" 1GP.
If TaskRay is a 2GP, then I am now sure what the issue would be.
cross posting to @Unlocked Packages as this discussion is relevant.