function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MktdevMktdev 

Publisher Action in Lightning Components is Undefined

I am trying to publish event to canvas app but unable to do so.

Components
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
    <!--<ltng:require scripts="/resource/canvas/canvasall.js"
             afterScriptsLoaded="{!c.jsLoaded}" />-->
    <ltng:require scripts="/canvas/sdk/js/36.0/publisher.js"
             afterScriptsLoaded="{!c.jsLoaded}" />
    <ltng:require scripts="/canvas/sdk/js/36.0/controller.js"/>
    
	<ui:button label="Framework Button" press="{!c.handleClick}"/>
<force:canvasApp developerName="NodeJS_app" canvasId="testing" />

</aura:component>


Controller
({
    jsLoaded: function(component, event, helper) {
        console.log('canvas ready to go');
    },
    handleClick : function(cmp, event) {
        console.log(Sfdc)
        Sfdc.canvas.publisher.publish({name : 'mynamespace.myevent',
                                        payload : {'fff':'ff'},
        								target : {canvas : 'testing'}});
    }
})
Error
Uncaught Action failed: c$rebootApp$controller$handleClick [Cannot read property 'publish' of undefined]


 
Best Answer chosen by Mktdev
MktdevMktdev
This was due to Lightning Locker Service which was blocking Canvas SDK so its a bug.

All Answers

MktdevMktdev
This was due to Lightning Locker Service which was blocking Canvas SDK so its a bug.
This was selected as the best answer
Nagen SahuNagen Sahu
Was this bug fixed ?
MktdevMktdev
Yes, it was bug and fixed now.