4

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.

  • did you figure this out? – NSjonas May 22 '19 at 5:09
4

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.

0

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.

  • 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. – salesforce-hacker Mar 14 '18 at 18:40
  • Yes, should work then. – Fabien Taillon Mar 14 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.