I'm trying to create a simple Lightning Component that is throwing me an Unknown Error of unable to create Locker. My code is this:

Need a Summer '16 pre-release Org to Test & Verify.


    <ltng:require scripts="/resource/my_utility/js/jquery-1.8.3.min.js"
                  afterScriptsLoaded="{!c.performInit}" />



    performInit : function(component, event, helper) {
        console.log('INIT... ');

The test result should be Browser Console should show "INIT..." log message, instead it throws a System Alert Dialog with message content:

Uncaught Error: Unable to create locker IIFE: TypeError: Cannot redefine property: selected throws at https://vc-summ16-3-dev-ed.lightning.force.com/auraFW/javascript/-7CZX427kzYqF5Ue_LxtNg/aura_prod.js:1:27

I know, with Summer' 16 LockerService is enabled, so does this mean, we now cannot use any javascript library in Lightning Component? If Now, then is there any specific way we can access or load jQuery in a my Lightning Component? If I remove following line scripts="/resource/my_utility/js/jquery-1.8.3.min.js" then the Component works fine and the performInit() console message is shown in console window.

This above code works perfectly fine in any other org which does not have Summer '16.


Above error is totally dependent on jQuery Library Version I include in my component. I was able to reproduce 3 different errors by simply referencing a different jQuery Library version:

Using jquery.1.8.3.min.js - scripts="/resource/my_utility/js/jquery-1.8.3.min.js":

Uncaught Error: Unable to create locker IIFE: TypeError: Cannot redefine property: selected throws at https://vc-summ16-3-dev-ed.lightning.force.com/auraFW/javascript/-7CZX427kzYqF5Ue_LxtNg/aura_proddebug.js:13801:7

Using jquery.1.11.1.min.js - scripts="/resource/my_utility/js/jquery-1.11.1.min.js":

Uncaught Error: Unable to create locker IIFE: Error: Re-setting of sCallback is prohibited throws at https://vc-summ16-3-dev-ed.lightning.force.com/auraFW/javascript/-7CZX427kzYqF5Ue_LxtNg/aura_proddebug.js:13801:7

Using jquery-2.2.3.min.js - scripts="/resource/my_utility/js/jquery-2.2.3.min.js":

Uncaught Error: Unable to create locker IIFE: TypeError: Cannot redefine property: minlength throws at https://vc-summ16-3-dev-ed.lightning.force.com/auraFW/javascript/-7CZX427kzYqF5Ue_LxtNg/aura_proddebug.js:13801:7

  • If I'm not mistaken, using the locker service runs included JS resources in use-strict mode. Do you know if your jQuery loads properly outside of Lightning using use-strict? – Antonio Manente May 9 '16 at 18:17
  • 1
    I've used the same jquery resource in a visualforce page and that page works well, and I then used 'use strict' in that page to confirm if it breaks or not, it continued working well. – VarunC May 9 '16 at 18:23
  • Out of the blue: Do you have a namespace activated? Your code uses the standard namespace. I got the idea since there was a locker update in Summer 16 making namespaces very strict – Christian Szandor Knapp May 9 '16 at 18:54
  • No namespace in the org. Should I activate namespace? I'm currently using default c: namespace ... – VarunC May 9 '16 at 18:55
  • Please do not namespace the org ,it will affect other components as well .Don't think namespace is the issue here – Mohith Shrivastava May 9 '16 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.