For my client, I am using Chart.Js and d3. After I have moved my code to new org which has locker service enabled. None of my components work. All the object defined in the JS are throwing undefined error.

What can I do ?

https://developer.salesforce.com/blogs/developer-relations/2016/04/introducing-lockerservice-lightning-components.html The locker service doc says the below in faq :

Can I use 3rd party libraries (React, Angular, etc) if running in Locker? Yes​, provided they are served from Static Resources and approved by security.

What does this mean "approved by security" ? Can't we use any other external Js library ?

Also while running the CLI tool, it seems it doesn't consider the scripts in staticresource file. then obviously it will have errors. Right ?

  • Hey Doug, Thanks for ur reply. It's a big sigh of relief having some1 replying on Locker service issues! The Locker service do not give the compilation error & on running doesn't give the appropriate errors related to static resource(it just doesn't update the document). Below document isn't detailed enough to carry out the changes? developer.salesforce.com/blogs/developer-relations/2016/04/… Can you pls suggest a document, so we may know what kind of changes we need to make in the external library files? Looking for your reply!
    – Heisenberg
    Jul 22, 2016 at 9:15
  • Also how about other libraries like Full calendar.js and the jquery file ?
    – Heisenberg
    Jul 22, 2016 at 9:15

1 Answer 1


The latest version of Chartjs should work fine but there is a known issue with D3 that make it not entirely strict mode compliant. There is a trivial chance to d3.js you can make that fixes this and we are working with D3 to get the fix into their codebase.

The CLI needs to be hinted using eslint annotations to suppress the errors it logs for unknown global symbols. The CLI and the linter it uses are not part of LockerService's implementation and its reported results are overly strict currently. The real answer is to run your components under locker and test them. The linter is only a starting point tool that helps highlight areas in bulk that might require attention.

  • Doug, thanks for the response here. I was able to update to the latest Chartjs and have it work in LockerService. Is there a better way of getting informed for these sorts of updates? I'm trying really hard to not need to maintain forks of libraries in order to work with LockerService. Thanks again! Jul 10, 2016 at 21:23
  • 1
    On 2nd testing the current version of ChartJS still throws a Uncaught TypeError: Right-hand side of 'instanceof' is not an object when hovering. Jul 10, 2016 at 23:29
  • @RowanChristmas: I am also facing this issue.... Were you able to fix this? Aug 6, 2016 at 18:53
  • @ThisIsRSN I've been using my fork of ChartJS... if you're interested I'll make it public. The official release is still using instance of (last I checked), and which is totally not allowed. Aug 8, 2016 at 5:55
  • @RowanChristmas Absolutely, Please share it. This will be helpful to me and others facing this issue. Much Appreciated :) Aug 8, 2016 at 12:28

You must log in to answer this question.

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