0

I am getting this error when I create version of a new second generation managed package. The project has simple Apex class without code and dependency on single 1st generation managed package.

Are the any workaround for the error e.g. specifying some settings to project-scratch-def.json?

Apex Class:

public with sharing class MyApexClass {

}

sfdx-project.json (Ids, package name, alias, dependent package name, and version are changed):

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "my package name",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "dependencies": [
                {
                    "package": "[email protected]"
                }
            ]
        }
    ],
    "name": "my project name",
    "namespace": "mynamespace",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "52.0",
    "packageAliases": {
        "my package name": "0Hoxxx",
        "[email protected]": "04txxxxx"
    }
}
2
  • If there's a dependency on another package, have you declared that in the sfdx-project.json? I suggest you edit your question to include detail of the Apex class and the sfdx-project.json. Without more info it's possible you won't get an answer.
    – Phil W
    Jul 16, 2021 at 11:29
  • @PhilW Yes, I have declared the dependency. I have added code snippets with the Apex class and sfdx-project.json Jul 16, 2021 at 13:54

1 Answer 1

2

I have found the reason of the issue. It failed because of broken project-scratch-org-def.json file.

I have added objectSettings section to settings

{
  "orgName": "MyCompany",
  "edition": "Developer",
  "features": [],
  "settings": {
    "objectSettings": {
       "account": {
          "defaultRecordType": "default"
       }
    }
  }
}

instead of adding it to the root https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm

{
  "orgName": "MyCompany",
  "edition": "Developer",
  "features": [],
  "objectSettings": {    
     "account": {
        "defaultRecordType": "default"
     }
  }
}

You must log in to answer this question.

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