Skip to main content
Bounty Awarded with 250 reputation awarded by Eric
Added my sfdx-project.json and a detail from the comments that may help others
Source Link
Aidan
  • 14.2k
  • 1
  • 42
  • 86

Updates

Some updates from our discussion in comments:

If you don't know the installation URL, you can obtain the 04t key by running:

force:package:installed:list 

on the scratch org. In Eric's case, adding the package key to his sfdx-project.json still resulting in a failure during package building.

For reference, here's the whole sfdx-project.json from a 2GP package of mine that depends on managed 1GP packages:

{ "packageDirectories": [ { "path": "force-app", "package": "My Package", "versionName": "ver 0.6", "versionNumber": "0.6.0.NEXT", "default": true, "dependencies": [ { "subscriberPackageVersionId": "04t1..." }, { "subscriberPackageVersionId": "04t5..." } ], "ancestorVersion": "0.5.0.1" } ], "namespace": "nebc", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "43.0", "packageAliases": { "My Package": "0Ho...", "My [email protected]": "04t...rQAC", "My [email protected]": "04t...1QAC", "My [email protected]": "04t...6QAC", "My [email protected]": "04t...QQAS", "My [email protected]": "04t...VQAS", "My [email protected]": "04t...bQAC" } } 

Updates

Some updates from our discussion in comments:

If you don't know the installation URL, you can obtain the 04t key by running:

force:package:installed:list 

on the scratch org. In Eric's case, adding the package key to his sfdx-project.json still resulting in a failure during package building.

For reference, here's the whole sfdx-project.json from a 2GP package of mine that depends on managed 1GP packages:

{ "packageDirectories": [ { "path": "force-app", "package": "My Package", "versionName": "ver 0.6", "versionNumber": "0.6.0.NEXT", "default": true, "dependencies": [ { "subscriberPackageVersionId": "04t1..." }, { "subscriberPackageVersionId": "04t5..." } ], "ancestorVersion": "0.5.0.1" } ], "namespace": "nebc", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "43.0", "packageAliases": { "My Package": "0Ho...", "My [email protected]": "04t...rQAC", "My [email protected]": "04t...1QAC", "My [email protected]": "04t...6QAC", "My [email protected]": "04t...QQAS", "My [email protected]": "04t...VQAS", "My [email protected]": "04t...bQAC" } } 
Source Link
Aidan
  • 14.2k
  • 1
  • 42
  • 86

Perhaps I'm being really dumb here, but can't you get the 04t id for the package by reading it off the installation URL? e.g. if I try to install Lightning Flow Sample Pack from AppExchange, I end up at:

lightning.force.com/packagingSetupUI/ipLanding.app?apvId=04t1I000003coh8QAA&src=U 

From which I can just read the 04t. I've successfully built 2GP packages that depend on my own 1st generation packages with just

 "dependencies": [ { "subscriberPackageVersionId": "04t..." } ], 

So, hopefully, you can do something like that.