3

According to release notes etc. Canvas should now work in Lightning Experience courtesy of the <force:canvasApp> tag.

In practice, we get this error message:

Something has gone wrong. Cannot read property 'length' of null

(there is no way that is actually coming from my Canvas app... its definitely being thrown out by the Lightning Component, please read on!)

So, we have built the simplest "hello world" application, and when we view the canvas app in the canvas app builder it's fine, and if I embed it in a bit of standard Visualforce it's fine, I can see this simple "hello".

Even if I add this Canvas app straight into visualforce with the old <apex:canvasApp> tag - it works fine. Equally, if I remove the <force:canvasApp> and just put a noddy Lightning component in the page layout, that works fine...

It's just when I put the Canvas app into the Lightning component, nothing I try gets me away from this Javascript looking error. There is nothing in the JS Console, and I tried breakpoints in Lightning Out and everything. It just doesn't work.

Any input on experience with Canvas in Lightning is more than welcome!

1

I'm having the same problem. Not that it's a preferred solution, but you can put the canvas app in a VF page and put the VF page in a Lightning Page.

The issue that I now have because of that (at least on mobile) is that you aren't able to scroll because of the iframe/scrolling issue.

  • So do you mean just using the standard <apex:canvasApp> tag and skipping the lightning component part? That would meet the functional requirement I guess, so is a solution of sorts. The requirement in my scenario though is to "prove" that our canvas apps will work in lightning components (as per the documentation!).. which I guess is a no for now (Feb'16) – Simon Lawrence Feb 17 '16 at 13:43
  • This is what we did to solve the problem: 1. Created a connected app 2. We created a VF page that looks like: <apex:page > <apex:canvasApp applicationName="xxxx" height="100%" width="100%" maxHeight="infinite"/> </apex:page> 3. Created a VF tab for it. 4. Went to Setup > App Menu and made sure our app was visible. 5. Went to Setup > Mobile Administration > Salesforce1 Navigation and added our app as an available navigation menu item. Note the "Inifinite" setting for maxHeight above. If you don't have that and your connected app renders a page longer than 2000px, it will cut off content. – mb22 Feb 18 '16 at 17:54

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.