2

I am trying to create a Managed package version.

But when I run the command:

sfdx force:package:version:create --package "MyApp" --postinstallscript AppInstallHandler.cls -w 10 --definitionfile config/project-scratch-def.json  --loglevel TRACE

I get an error response of:

ERROR running force:package:version:create: MyApp: Installing an app (MyApp) that has been deleted.

This error message isn't giving me any clue regarding what the root cause is.

The source does include a ConnectedApp, is it OK to try and include a ConnectedApp in a second-generate Managed package?

Any other ideas what might be causing this?

1
  • I've got this error when trying Mohit's linked solution but connectedApp version was wrong - had to use 1.0 even when UI updated to 2.0 after releasing 1st gen package.
    – dzh
    Commented Mar 23, 2021 at 1:44

1 Answer 1

3

This is because you have a Connected Apps source in your 2GP package.

There is a unique way to package this up and I have answered it here

Get rid of the Connected Apps file from your project directory and make sure you follow the steps here

2
  • 1
    Mohith's answer is definitely correct. I got this same error and it was because I had included the <oauthConfig> metadata node with some preset values. This was unnecessary since the <version> is enough to set the values correctly based upon the 1GP package version (you don't need to try to try and default any values). Note that I am setting the <permissionSetName> node just fine though, which is needed for my app. Commented Apr 23, 2022 at 19:25
  • @JonDuelfer - Are there any other keys that are permitted beyond version, developerName, label, and permissionSet? Wondering what is and is not permitted in the ConnectedApp XML definition for 2GP. Salesforce's docs here are not helpful: developer.salesforce.com/docs/atlas.en-us.api_meta.meta/… Commented Jan 26, 2023 at 19:04

You must log in to answer this question.

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