function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Georg WilleGeorg Wille 

Package Version Create Fails Unless --skipvalidation is Specified

Please someone look into thes urgently - without solution to this issue I cannot deploy the package to production.

I am developing an unlocked package. When executing the command: 
force:package:version:create -p Package -d force-app -k key -w 10 -v DevHub
I get a great many errors thrown at me: some 320 errors listed for a total of 450 lines as counted by the execution of the unit test classes.
Note that:
  • All parts of the code have been tested on my developer org, I can deploy all components from my VS Code project with no problem at all.
  • All of the errors fall into one of a few categories
ComponentName: Variable does not exist: qli
ComponentName: Invalid type: QuoteLineItem
ComponentName: Method does not exist or incorrect signature: void getEntityAlias(QuoteLineItem) from the type ComponentName
ComponentName: DML requires SObject or SObject list type: List<QuoteLineItem>
  • when I add the --skipvalidation flag to the command the package builds with no errors. I can the install it on my scratch org and - according to the unit test execution - works as expected.

 
Best Answer chosen by Georg Wille
Vishwajeet kumarVishwajeet kumar
Hello,
I assuming you are aware that salesforce (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_code_coverage.htm) has introduced code coverage requirements and it will require 75% coverage to promote pacakges to org's other than sandboxes or scratch orgs.

It could be Test classes failing. From error's, it looks like it is falling due to not able to find "QuoteLineItem" object and some other components in package. Package is standalone bundle so it will need all componenets included which are used in code to work. .

Unit Test is working in sandbox/scratch org because of all components used in Test Classes being available in those orgs.

Thanks

All Answers

Vishwajeet kumarVishwajeet kumar
Hello,
I assuming you are aware that salesforce (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_unlocked_pkg_code_coverage.htm) has introduced code coverage requirements and it will require 75% coverage to promote pacakges to org's other than sandboxes or scratch orgs.

It could be Test classes failing. From error's, it looks like it is falling due to not able to find "QuoteLineItem" object and some other components in package. Package is standalone bundle so it will need all componenets included which are used in code to work. .

Unit Test is working in sandbox/scratch org because of all components used in Test Classes being available in those orgs.

Thanks
This was selected as the best answer
Georg WilleGeorg Wille
Actually it turned out that I had to add the following in my project-scratch-def.json file:
,
    "quoteSettings": {
      "enableQuote": true
    }
@Kumar: thx for your trouble.