0

I have a problem with the dependencies in the package and I don't understand why.

sfdx-project.json

{
"packageDirectories": [
    {
        "path": "force-app",
        "default": true,
        "package": "xxxxxxPackage",
        "versionName": "ver 0.1",
        "versionNumber": "0.1.0.NEXT",
        "definitionFile": "config/project-scratch-def.json",
        "dependencies": [
        
        {
            "package": "Nonprofit Success [email protected]"
        },
        {
            "package": "[email protected]"
        }
    
        ]
    }
],
"name": "xxxxx",
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "55.0",
"packageAliases": {
    "IDOPackage": "0Hoxxx",
    "Nonprofit Success [email protected]": "04t5d000001IB4yAAG",
    "[email protected]": "04t4w0000011MM6AAM"
}

Here the Error Message:

An error occurred while trying to install a package dependency, ID 04t5d000001IB4y: (Affiliations 3.11) A required package is missing, Details: Package "Affiliations", Version 3.11 or later must be installed first.

Does anyone have any input on what I can do differently?

2 Answers 2

1

Dependencies are installed in the order specified in your JSON. Make sure Affiliations comes before NPSP.

{
    "package": "[email protected]"
},
{
    "package": "Nonprofit Success [email protected]"
}
1
  • Thanks. Solve the Issue.
    – EricM
    Commented Aug 16, 2022 at 13:32
0

I'd highly recommend looking into CumulusCI for building extensions of NPSP. Its dependency handling logic is dynamic so you don't have to hard code version numbers in the file and keep up with new versions as they're released and push upgraded. CumulusCI is the tooling used by the NPSP team to handle all of NPSP's dependencies which you can tap into in your own extensions.

The sfdx-project.json you showed only includes NPSP and Affiliations but installing NPSP requires 5 other managed packages to be installed before NPSP. In order, those are Contacts & Organizations, Households, Recurring Donations, Affiliations, and Relationships. It also requires that you deploy a record type for Account and Opportunity though it doesn't care which record type that is. This is to ensure the Account.RecordTypeId and Opportunity.RecordTypeId fields are available in the org since, frustratingly, they don't exist on objects that don't have record types.

CumulusCI handles all that complexity for you and will automatically populate the 2GP dependencies to the latest versions.

At a high level, you'd want to:

Note that with this approach, you don't need to edit your sfdx-project.json file with any info about your package. CumulusCI works directly with the same Tooling API objects that sfdx does but provides a simpler interface to creating 2GP extension packages.

You should be able to configure CumulusCI in your existing repo without impacting any of your existing work. You will need to edit the scratch definitions under orgs/ to make sure they have the features and settings your extension package needs in its scratch orgs.

You can also check out this video: https://www.youtube.com/watch?v=emntX94WvMw

Disclaimer: I created CumulusCI at Salesforce.org years ago and ran the team that builds it until recently. I have a bias but do believe this is the right objective advice for your use case.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .