3

When deploying metadata containing an ExperienceBundle and a component (for instance, with sfdx metadata deploy commands to prod, or when pushing to a new (empty) scratch org), we are frequently (but not always) getting an error:

Error  force-app/main/default/experiences/Events2.site-meta.xml  Specify "lightningCommunity__Page" as the target for the Lightning web component c:footer in Events2/views/host.json and try again.

Deploying c:footer alone, followed by the full deployment (containing the same LWC, no changes), usually resolves the issue. What is odd, is this issue occurs even when neither metadata changes.

Something that has never been an issue, but is odd - we have an Events site and an Events community, so instead of the ExperienceBundle being called Events1, it is Events2 instead. No issues have come up from this... so far.

The footer metadata is like this (will try updating the API version now that I see it):

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>47.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightningCommunity__Page</target>
        <target>lightningCommunity__Default</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightningCommunity__Default">

            <!-- omitted -->

        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

And, usage in the ExperienceBundle host.json JSON looks like:

"components" : [ {
      "componentAttributes" : {
        /* all of the properties are correct and match the ones in the js-meta */
      },
      "componentName" : "c:footer",
      "id" : "<uuid omitted>",
      "renderPriority" : "NEUTRAL",
      "renditionMap" : { },
      "type" : "component"
    } ],
2
  • 1
    Could this be because of the API version?
    – Phil W
    Commented Jan 31, 2022 at 19:08
  • I think the bundle might be trying to resolve a few things before deploying, that time if any change happened in the dependent component might not be fetched, that's the reason it's working flawlessly when you deploy LWC/dependent components first and community later.
    – Ysr Shk
    Commented Feb 1, 2022 at 3:33

1 Answer 1

0

I also get this error. Salesforce said they fixed this in Summer '20, but I still get it now. According to this fix the workaround is to deploy they separately (LWC first), as mentioned above.

You must log in to answer this question.

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