Can anyone use the new Message Channel feature?

1,373 views
Skip to first unread message

Cory Newey

unread,
Oct 1, 2020, 6:06:14 PM10/1/20
to Illuminated Cloud Q&A
I am creating a Lightning Web Component component that needs to work with an existing Aura component. They will of course have to use events to communicate. I'm trying to follow Salesforce's documentation to use the new Message Channel to set up an event publish/subscription model of communication.

I've created a new Message Channel meta xml (ZPViewDocument.messageChannel-meta.xml) file and successfully deployed it to my development org. It looks like this:

?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>View Document Event Channel</masterLabel>
    <isExposed>true</isExposed>
    <lightningMessageFields>
        <description>Holds the zPaper Id of the Document to be displayed in the Viewer</description>
    </lightningMessageFields>
</LightningMessageChannel>

I'm now trying to use that channel in my Aura component. I've added the following to my .cmp file:

<lightning:messageChannel type="ZPViewDocument__c" aura:id="zpViewDocument" onMessage="{!c.handleReceiveChannelMessage}"/>

However, when I try to deploy the Aura component, I get the following error:


Has anyone been able to get this to work?

Scott: I assume that IC is using the CLI to deploy the Salesforce resources. Is there some way to see the response that the CLI call is getting so I can see if it has more information than what is being displayed in the error dialog that I am seeing?

Thanks.

Scott

unread,
Oct 1, 2020, 6:08:48 PM10/1/20
to Illuminated Cloud Q&A, Cory Newey
Cory, I don't see the error, but I've successfully deployed usages of the lightning:messageChannel component. Can you please try to post the error again? It would also likely be useful to enable debug logging for metadata deployment, reproduce the issue, and shoot over the resulting idea.log as that will have all of the details.

Regards,
Scott

Cory Newey

unread,
Oct 1, 2020, 6:09:34 PM10/1/20
to Illuminated Cloud Q&A, Cory Newey
In my original post, I pasted in an image that showed the error that I am seeing. However, that image didn't make into the post. Here is the text of the error dialog that I am seeing when I try to deploy the Aura component:

Deployment failed (UNKNOWN_EXCEPTION) - UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if yo contact support: 176219635-229408 (2073891416)

Thanks again.

Scott

unread,
Oct 1, 2020, 6:11:26 PM10/1/20
to Illuminated Cloud Q&A, Cory Newey
Okay, so you're getting a GACK, effectively a Salesforce internal server error. Those are for the most part opaque to external consumers, i.e., not Salesforce employees. You'll need to get more details on the real issue behind it, either by logging a case with Salesforce or, if you have someone on the inside, getting them to look it up for you. Unfortunately an IC debug log won't be able to provide any additional diagnostic info.

Regards,
Scott

Cory Newey

unread,
Oct 1, 2020, 6:16:45 PM10/1/20
to Illuminated Cloud Q&A, Scott, Cory Newey
Thanks Scott. Not the news I wanted but I always appreciate how quickly you respond to support questions.

Could you take a quick look at my Channel metadata and the line I'm using to include the channel in my Aura component to see if you notice anything obvious?

Thanks.

Cory Newey

unread,
Oct 1, 2020, 7:00:24 PM10/1/20
to Illuminated Cloud Q&A, Cory Newey, Scott
Hi again Scott:

I think I've found what the problem is. When I view the "Illuminated Cloud" message window at the bottom of intelliJ after the failed Aura component deployment I see this message:

Error:(1, 1) org.auraframework.throwable.AuraRuntimeException: Unable to retrieve metadata for descriptor: markup://ZPAPER5:__LightningMessageChannel__ZPViewDocument__c

It looks like the deployment of the Message Channel meta xml is not actually not succeeding. Just to be sure, I went into workbench.developerforce.com and look at the LightningMessageChannel metadata and it says that I don't have any channels defined.

Any idea why it would report that the deployment of the channel metadata was successful when it actually wasn't?

Side question:

Is there any way to execute an sfdx CLI command from within IC in intelliJ? If so, I'll try to deploy the channel metadata that way.

Thanks.

Cory Newey

unread,
Oct 1, 2020, 7:09:54 PM10/1/20
to Illuminated Cloud Q&A, Cory Newey, Scott
More info:

When I look at the IC Messages window at the bottom of intelliJ after a "successful" deployment of the Message Channel metadata xml file, it says this: "Deployed 0/0 components to zPaper Wilco Lightning in 1 s 425 ms with status SUCCEEDED"

So it looks like I was correct, nothing is actually being deployed.

When I created my Message Channel metadata, I had to first create a new messageChannels directory. Is there something I need to do to tell IC to associate that directory with Message Channel components?

Thanks.

Mark Keckeis

unread,
Dec 10, 2020, 12:23:56 PM12/10/20
to Illuminated Cloud Q&A, Cory Newey, Scott

Hey Corey - you say that you created the message channel and successfully deployed it. Did you use ANT? Is there a way to do it using IC? 

I have a messageChannel in local  WebStorm (using IC). When I deploy metadata - I dont see the messageChannel metadata type.

Many thanks

Scott

unread,
Dec 10, 2020, 12:36:13 PM12/10/20
to Illuminated Cloud Q&A, mark.k...@gmail.com, Cory Newey, Scott
Mark, the metadata type is LightningMessageChannel, and the corresponding folder name is messageChannels. So you'd see the following in the subscription editor:

Message_Channel_Subscription_Editor.png

and the following in the build options dialog (used for deploy/retrieve/delete):

Message_Channel_Build_Options_Dialog.png

If you don't see it in either, make sure to refresh the list of server metadata:

Refresh_Metadata_List.png

Regards,
Scott Wells

Erdna Voliva

unread,
May 29, 2023, 2:05:14 PM5/29/23
to Illuminated Cloud Q&A, Scott, mark.k...@gmail.com, Cory Newey
Hello Scott,
i still cannot deploy it. can you help me?  

Unbenannt.PNG
Unbenannt.PNG

Scott

unread,
May 29, 2023, 2:08:58 PM5/29/23
to Illuminated Cloud Q&A, Erdna Voliva, Scott, mark.k...@gmail.com, Cory Newey
Based on the provided screenshot, it looks like you have a file with source format naming being used in a metadata format project. Rename the file to just BootMessageChannel.messageChannel (i.e., remove the "-meta.xml" portion of the filename) and my guess is that it will work just fine.

Regards,
Scott Wells
Reply all
Reply to author
Forward
0 new messages