2

I'm working on a lightning component, and have started getting the error below.

It seems to happen frequently as I'm adding methods to the helper and controller. In other words, I've created a few components to try and remedy the issue, but keep running into it when I start adding the JavaScript logic.

If I delete all the methods in the controller and delete everything in the component, and refresh the page twice (there's a weird caching delay there), the error still sticks around.

The error happens both in a Lightning Record page as well as a regular Lightning Page, both created in App Builder.

Anyone else encounter this and know how to fix it, without having to start from scratch with a new component?

Uncaught Action failed: flexipage$component$controller$init [TypeError: componentClass is not a function] throws at https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:14705:9 at new ComponentDef (https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:5741:5) at AuraComponentService.$createFromSavedComponentConfigs$ (https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:10625:13) at AuraComponentService.$getComponentDef$ (https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:10596:23) at AuraComponentService.$getDef$ (https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:10605:18) at Object.components.createComponent (https://somedomain.lightning.force.com/l/%7B%22mode%22%3A%22PRODDEBUG%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22HARM87fxppWmsEY_Ve9awQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22PoCrtEvaxEZnhJ-4Mul9nA%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22NN%22%7D/app.js:108275:48) at createComponentWithStateOverrides (https://somedomain.lightning.force.com/l/%7B%22mode%22%3A%22PRODDEBUG%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22HARM87fxppWmsEY_Ve9awQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22PoCrtEvaxEZnhJ-4Mul9nA%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22NN%22%7D/app.js:108492:20) at Object.components.createPanel (https://somedomain.lightning.force.com/l/%7B%22mode%22%3A%22PRODDEBUG%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22HARM87fxppWmsEY_Ve9awQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22PoCrtEvaxEZnhJ-4Mul9nA%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22NN%22%7D/app.js:108414:9) at Object.instantiateComponent (https://somedomain.lightning.force.com/l/%7B%22mode%22%3A%22PRODDEBUG%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22HARM87fxppWmsEY_Ve9awQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22PoCrtEvaxEZnhJ-4Mul9nA%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22NN%22%7D/app.js:68238:38) at init (https://somedomain.lightning.force.com/l/%7B%22mode%22%3A%22PRODDEBUG%22%2C%22app%22%3A%22one%3Aone%22%2C%22fwuid%22%3A%22HARM87fxppWmsEY_Ve9awQ%22%2C%22loaded%22%3A%7B%22APPLICATION%40markup%3A%2F%2Fone%3Aone%22%3A%22PoCrtEvaxEZnhJ-4Mul9nA%22%7D%2C%22requestedLocales%22%3A%5B%22en_US%22%2C%22en%22%5D%2C%22ls%22%3A%22NN%22%7D/app.js:68228:14) at Action.$runDeprecated$ (https://somedomain.lightning.force.com/auraFW/javascript/HARM87fxppWmsEY_Ve9awQ/aura_proddebug.js:7066:36)

Edit: Here's the JS helper code that seems to be initially throwing the componentClass is not a function error:

loginHelper : function(component,requestEndpoint){
    debugger;
    var action = component.get("c.loginViaOAuth");
    action.setParams({requestEndpoint : requestEndpoint,redirectUri : window.location.pathname)});
    action.setCallback(this, function(a) {
        debugger;
    });
    $A.enqueueAction(action);
}

1 Answer 1

3

This is actually a syntax error. There's a bad right parenthesis after window.location.pathname.

2
  • Can you add the relevant code and how to fix it? This got flagged as low-quality because of its length and content.
    – Adrian Larson
    Commented Jul 16, 2016 at 15:41
  • 1
    The lightning error reporting could have been better. I faced the same situation and this post helped me. Thanks!
    – javanoob
    Commented Dec 28, 2016 at 18:36

You must log in to answer this question.

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