+ Start a Discussion
Anatoliy BaranchykovAnatoliy Baranchykov 

Canvas app in Lightning component showing blank screen every second time

I have a problem with canvas app on lightning component. Sometimes my canvas app is blank.

Here is an example of my lightning component :

<aura:component implements="force:appHostable" >
    <aura:handler name="init" action="{!c.doInit}" value="{!this}" />
    <force:canvasApp developerName="MyCanvas" applicationName="MyCanvas"  canvasId="Canvas" aura:id="Cars" border="yes" width="100%" height="600"  scrolling="yes"  namespacePrefix=""/>

Scenario when not working:

If I open my canvas app from Salesforce Lightning Experience app luncher at first

Salesforce Lightning Experience app luncher -> MyApp -> MyCanvasAppTab

My canvas app is being fully loaded to iframe and i can work with it.

If now i  open again my canvas app again using Salesforce Lightning Experience app luncher

Salesforce Lightning Experience app luncher -> MyApp -> MyCanvasAppTab

At this time my canvas app is blank and in iframe i see only blank tags <title></title><body></body>.
I've checked that I'm connected to my external app and return data by canvas app request.

If now I refresh the page with canvas app I see my external up again.

Can somebody help me, please?

Pradeepkumar ManegallaPradeepkumar Manegalla
we are also facing the same issue, up on refresh the canvas app loads ..
My scenario-canvas lightning component in opportunity layout , assume there are 10 opporutnitites and canvas app opens for the first opporutnity when i got to the second opporutnity canvas app does not load ,loads only upon refresh.
Not sure how to solve this .used window.reload() but goes in to loop, used $A.getrefreshview -loads only the detial page but not the canvas component.
trying to figure out the solution , fingers crossed.
Varun Manchikalapudi 5Varun Manchikalapudi 5
We are facing the same issue. How to resolve this?
I am also facing same issue,any body resolve this please help us..
Hi i resoved this,

Here is the sample

ComponentCanvas :

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
    <force:canvasApp developerName="canvasappname" namespacePrefix=""  parameters='{"xxx":"123","yyy":"4444"}'    width="infinite" /> 

<aura:application >
    <c:ComponentCanvas />


David Boukhors - GirafeDavid Boukhors - Girafe

I am facing same issue, but your solution does not seem to work for me. Where was you canvas app located? I am using it as a "Lightning Component"  in a Console Utility Bar

Steps to follow : 
- When you click for the first time you can see the content of the Canvas App (Salesforce Standard Sample).
- One you click again to hide the component, it becomes invisible event if you click again to display it.
- The DOM/Content is still there, but invisible.

Configuration :
- macOS High Sierra
- Chrome (up to date): Version 63.0.3239.132 (Official Build) (64-bit)


Lightning Component "CanvasTestComponent"
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<force:canvasApp developerName="CanvasTest" />

Thanks in advance.

David Boukhors
Anatoliy BaranchykovAnatoliy Baranchykov
For me problem was in parameter "canvasId".
The problem is that if you set this parameter in the <force:canvasApp /> then salesforce create DOM elment with the same "canvasId" each time, but updates the first of them thats why on second time we see blank place. If you delete the "canvasId" then this parameter will be added with the random value.

So the resolution for me is just to delete "canvasId" parameter at all.

Hope this helps.
pradeep kumar manegallapradeep kumar manegalla
Folks ...the problem was with "canvasID" ,had a session with SFDC RnD team ,they suggested not to use CanvasId as its creating  a cache issue.In future releases they would certainlty work regarding this error.Thanks to Anatoliy Baranchykov for finding out.Please mark as the best solution
The problem was resolved for the latest versions of browsers . 
For Chrome : Version 65 or later 
For Firefox : Version 59 or later