3

We've been running Jenkins builds for a while containing:

sfdx force:package:version:create --skipvalidation ...

with no problem, but now we are preparing to promote to a release, removing the --skipvalidation causes multiple errors of this form to be reported:

You need to enable Communities to be able to install Lightning pages of type...

It is not clear to me where the packaging work is done and so where I need to "enable Communities". The DevHub org?

What is the solution to this problem?

1
  • 1
    I wouldn't recommend using --skipvalidation if you're planning to release a package. It doesn't force you to have test coverage, and it doesn't take advantage of the ancestorId (sfdx-project.json) to check if your package version can be upgraded, also you can't release this type of package version. I believe that the --skipvalidation gives you more "freedom" to play around, and run spikes, but in this case it gives you a false sense of security that the "version:create" is working. May 21, 2020 at 10:33

1 Answer 1

4

The packaging for a second-generation package takes place in a "behind-the-scenes" scratch org that Salesforce calls a build org. That build org needs to be configured with the right features in its definition file, which is provided to force:package:version:create with the [-f DEFINITIONFILE] argument.

You can potentially reuse an existing scratch org configuration file here, or pare one down just for package builds to include features: ["Communities"] (or ["Communities", "Sites"], and so on) to make the package build work.

3
  • Makes sense. Thanks David!
    – Keith C
    May 20, 2020 at 17:55
  • Onto the next round of errors "The Lightning Web Component Bundle '...' in this managed package must be marked 'isExposed=true'". Thanks again.
    – Keith C
    May 20, 2020 at 18:52
  • +1 Though to be pedantic, it's not actually creating a Scratch Org. This implies that it's some sort of org that you can later log in to and do stuff with. It uses the same basic mechanism as the "Upload Package" function of first generation packages, where it simply validates all the metadata against a given configuration, then stores the results of that build in a deployable form (probably reminiscent of the old DOT format that they used to clone orgs with).
    – sfdcfox
    May 20, 2020 at 18:52

You must log in to answer this question.

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