I have 2 sibling components inside a visualforce page. When i try to write pubsub events in the LWC components i am getting the below error

This page has an error. You might just need to refresh it. Error in $A.getCallback() [afterRender threw an error in 'c:lwcContainer' [pubsub listeners need a "@wire(CurrentPageReference) pageRef" property]] Failing descriptor: {ltng:outApp}

VF Page Code

    <apex:includeLightning />

    <div id="lightningvf" />

        $Lightning.use("c:lwcvf", function() {
              function(cmp) {
                console.log("button was created");
                // do some stuff

i have used the below blog to create 2 lightning web components https://www.santanuatonline.com/publish-subscriber-model-in-lightning-web-component/

How do i communicate between these 2 sibling LWC's which are residing inside the vf page?

1 Answer 1


I would maybe use the Lightning Messaging Service instead of the LWC pubsub.

See for example https://releasenotes.docs.salesforce.com/en-us/summer20/release-notes/rn_lc_message_channel.htm

You must log in to answer this question.

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