[SalesForce] How to specify a managed package key in a sfdx-project.json dependencies entry

It seems like it should be simple, but I have googled this and failed.

I'm writing a project using Packaging 2 in sfdx, and it depends on an old managed package. I've installed that package into my scratch org, but now I'm struggling to generate a package.

Here's my sfdx-project.json:

{
  "packageDirectories": [
    {
      "path": "force-app",
      "id": "0HoXXXX",
      "versionNumber": "1.1.0.0",
      "versionName": "Initial",
      "ancestorId" : "05iXXX",
      "versionDescription": "Including Related List",
      "default": true,
      "dependencies": [{"subscriberPackageVersionId": "04tXXXX", "installationKey": "XXX"}]
    }
  ],
  "namespace": "xxxx",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "41.0"
}

When I run

sfdx force:package2:version:create -i 0HoXXX -d force-app/ 

I get the response:

(1) Unable to parse package2-descriptor.json: invalid attribute 'installationKey'

Fair enough, but what is the right attribute for that? I can't find it from the documentation and none of my guesses have worked.

Best Answer

Salesforce have responded to this in the Packaging 2 Beta Trailblazer Community:

Unfortunately what you're describing is a known outage for Packaging 2 right now. We have work in progress to resolve this but it obviously has security implications which need to be carefully vetted.

Link (requires SF login):

https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?emkind=chatterCommentNotification&emtm=1518813023217&g=0F93A000000Lg5U&s1nid=0DB30000000072L&s1oid=00D300000000iTz&s1uid=0053A00000D4Cel

I've asked them to add it to the list of known limitations for Packaging 2: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_considerations.htm#package2-considerations

Related Topic