5

I am attempting to create a Second Generation package using the Salesforce CLI. I have a Dev Hub organization connected in which Second Generation packages are enabled. I run the following command to create a package...

sfdx force:package2:create --name Promoter_io

...and receive the following output on the command line:

ERROR: entity type cannot be inserted: Second Generation Package.

Here are my configuration files for the project:

package.json:

{
    "name": "Promoter.io V1.8.1",
    "version": "1.8.1",
    "scripts": {
        "start": "sfdx force:org:open"
    }
}

sfdx-project.json:

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true, 
      "id": "",
      "versionName": "v 1.8.1",
      "versionDescription": "Promoter.io 1.8.1",
      "versionNumber": "1.8.1.NEXT",
      "ancestorId": ""
    }
  ],
  "namespace" : "promoter",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "41.0"
}

Any information on how I can resolve or debug this error would be helpful.

1
  • did you figure this out?
    – NSjonas
    Commented May 22, 2019 at 5:09

2 Answers 2

6

When you enable the org-wide setting in the Dev Hub menu, the only user profile that will have the permission enabled is the default Sys Admin profile. If you use another profile in production, you need to grant the "Create and Update Second-Generation Packages" permission for the profile being used or otherwise add the permission to yourself.

I was stuck myself, but found this article to help: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_before.htm

You'll likely also want to give yourself/profile the "Promote a package version to released" permission.

1

Your user also need the Permission « Create and Update Second Generation Packages ». You should create a Permission Set for it and add it to you user.

2
  • Is this in the Dev Hub organization? I already have the "Create and Update Second-Generation Packages" enabled for the running user in that organization. Commented Mar 14, 2018 at 18:40
  • Yes, should work then. Commented Mar 14, 2018 at 18:40

You must log in to answer this question.

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