I have a lightning component on the app exchange that provides a canvas element for the user to draw their signature. In a Summer 16 pre-release org with the lightning locker service enabled, when I attempt to get the drawing context via :

this.ctx = this.canvas.getContext('2d');

I get the following error:

    TypeError: this.canvas.getContext is not a function. (In 
      'this.canvas.getContext("2d")', 'this.canvas.getContext' is undefined)
  • 1
    Thanks Bob - I've opened a bug to track getting this fixed - it missed the cutoff for the patch deploying Tuesday but I will get the fix in for the following week. May 5, 2016 at 13:00
  • 1
    I am trying to see if I can still get this into next weeks patch - just under the wire - stay tuned May 5, 2016 at 13:14
  • Any help would be appreciate. Thanks in advance. salesforce.stackexchange.com/questions/129883/… Jul 3, 2016 at 16:55

1 Answer 1


This is now fixed and I'm able to create a context, allow the user to draw into at and extract a data URL from it.

  • Bob, I've a different kind of issue but is related to Canvas. Can you take a look at my query and let me know if you have encountered this and have any workaround for this issue with <canvas> elements and LockerService - salesforce.stackexchange.com/questions/128548/…
    – VarunC
    Jun 23, 2016 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .