[SalesForce] “Something has gone wrong. Cannot read property ‘length’ of null. Please try again.” when using

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!

Best Answer

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.