1

We are working towards building a community where we have the need to communicate with different parts of the page built with LWC and Aura. Since salesforce launched lightning messaging service we thought it would be a good fit.

We are currently doing a POC for this and here is the current configuration I have.

  • Messaging Channel name community__c with once field named action.
  • Aura component (lmsPublisher)
  • Aura component (lmsReceiverAura)
  • LWC component (lmsReceiverLwc)

I create a simple page and added these components to the community. It all works fine if I am logged in to the community either as an admin or as a community user.

Issue:

As soon as the I try to access the public page with free user, I get an internal server error. I went through the limitations here but I don't see anything on permissions or availability for guest users.

I am raising it with Salesforce already but it is going to take time to get an official answer or resolution. Has anyone noticed this issue and had a resolution?

Things I checked:

  • Guest user has access to Salesforce API permission.
  • Community has enabled support for public Chatter API
  • Same page is available for both Guest and signed in users.

Components:

lmsPublisher

Component

<aura:component description="lmsPublisher" implements="forceCommunity:availableForAllPageTypes">
    <aura:attribute type="String" name="action" default="Waiting..."/>
    <lightning:messageChannel type="community__c" aura:id="channel-community"/>
    <h2 class="slds-text-heading_medium">Sending message</h2>
    <div class="slds-box">{!v.action}</div>
    <lightning:button label="Click to publish" onclick="{! c.handleClick }"/>
</aura:component>

JS

({
    handleClick: function (component) {
        let things = ['Rock', 'Paper', 'Scissor', 'Lizard', 'Spock', 'Shoot', 'Duck', 'Strike'];
        let thing = things[Math.floor(Math.random() * things.length)];
        component.find('channel-community').publish(
            {'action': thing}
        );
        component.set('v.action', thing);
    }
});

lmsSubscriberAura

Component

<aura:component description="lmsRecieverAura" implements="forceCommunity:availableForAllPageTypes">
    <lightning:messageChannel type="community__c" onMessage="{!c.listener}" scope="APPLICATION"/>
    <aura:attribute type="String" name="action" default="Waiting..."/>
    <h2 class="slds-text-heading_medium">Receiving message in Aura</h2>
    <div class="slds-box">{!v.action}</div>
</aura:component>

JS

({
    listener: function (component, message) {
        let action = message.getParam('action') || 'None';
        component.set('v.action', action);
    }
});

Screenshots:

Signed in user:

Signedin user

Guest user (Click to see live)

enter image description here

4
  • LMS is not currently supported in lightning communities. Try using pub/sub library or aura events (developer.salesforce.com/docs/component-library/documentation/…). – Vinay Oct 1 '20 at 23:43
  • Vinay. It works in the community atleast for all signed in users, that is something I have already tested. The first screenshot is for the community with signed in users. – manjit5190 Oct 2 '20 at 6:49
  • @manjit5190 Hi Have you fixed this? Right now I faced with the same problem – Vadim Jan 11 at 10:06
  • 1
    @Vadim Salesforce said that while the LMS works in community for logged in users, it is officially not supported in community, with Spring 21 release they have launched a beta for LMS in experience cloud help.salesforce.com/… – manjit5190 Jan 11 at 10:56
0

We faced the exact same issue. The page with lightning:messagechannel would not load for guest users while it worked for logged in user. Additionally, this issue only happened in production while in sandbox, it worked for both logged-in and guest users. We have also lodged a case with salesforce and waiting for their reply.

1
  • Probably your sandbox is on latest release while production is not. Before the latest release, salesforce said that while the LMS works in community for logged in users, it is officially not supported in community, with Spring 21 release they have launched a beta for LMS in experience cloud help.salesforce.com/… – manjit5190 Jan 23 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.