EmpApi can't process event notifications using filtered subscription during aura component initialization
Last updated 7 days ago ·Reference W-5986719 ·Reported By 45 users
In Review
Summary
EmpApi can't process pushtopic event notifications when calling the subscribe method on a channel using filtered subscriptions during a lightning component init method.
- Expected Result
EmpApi processes the notification.
- Actual Result
Client received notification but EmpApi didn't process it.
Repro
1. Create a new dev org and enable my domain.
2. Create lightning component:
Markup:
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:appHostable" access="global" >
<lightning:empApi aura:id="empApi" />
<aura:handler name="init" value="{!this}" action="{!c.onInit}"/>
<aura:attribute name="subscription" type="Map" />
<lightning:input aura:id="channel" label="channel" name="channel" type="text" value="{!'/topic/CaseChanges?Id='+v.recordId}"/>
</aura:component>
Controller:
({
// Sets an empApi error handler on component initialization
onInit : function(component, event, helper) {
const empApi = component.find('empApi');
empApi.setDebugFlag(true);
empApi.onError($A.getCallback(error => {
console.error(JSON.stringify(error));
}));
helper.subscribeHelper(component, event, helper);
}
})
Helper:
({
subscribeHelper : function(component, event, helper) {
const empApi = component.find('empApi');
const channel = component.find('channel').get('v.value');
const replayId = -1;
console.log('HELPER ' + channel);
empApi.subscribe(channel, replayId, $A.getCallback(eventReceived => {
// Process event (this is called each time we receive an event)
console.log('Received event ', JSON.stringify(eventReceived));
}))
.then(subscription => {
console.log('Subscribed to channel ', subscription.channel);
component.set('v.subscription', subscription);
});
}
})
3. Create a PushTopic called CaseChanges with query SELECT Id, Status FROM Case
4. Add the above lightning component onto a Case lightning page layout.
5. Open a case record.
6. Check the main browser console, observe the received event is not logged.
Workaround
- No workarounds at this time.
Reported By (45)












Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.