4

This gave me over 5 hours of brain damage, and yet don't have a solution. Can someone please assist?

UPDATE: markup in component:

<td>
    <div class="slds-truncate" >
        <a href="javascript:void(0);" onclick="{!c.nextStage}">Complete</a>
    </div>
</td>

UPDATE: controllerJS function:

nextStage: function(component, event, helper){
        console.log("----------------> nextStage 0");
        helper.completeStage(component, event, helper);               
    },

helperJS function:

completeStage : function(component, event, helper){
        console.log('---------------> completeStage 1 ');
        var action = component.get("c.uselessMethod");

        action.setCallback(this, function(response) {
            console.log('---------------> completeStage 2');
        });

        try{
            $A.enqueueAction(action);
        }
        catch(err3){
            console.log("---------------> completeStage EXCEPTION " + err3);
        }
    },

This is my apex controller method:

@AuraEnabled
    public static void uselessMethod(){
        system.debug(logginglevel.error,'------------------------------------> uselessMethod! ');
    }

Browser Console Log:

---------------> completeStage 1 
---------------> completeStage EXCEPTION TypeError: action.$getComponent$ is not a function

The callback is not being invoked at all. $A.enqueueAction(action) is generating an exception. No Apex debug log either. My web search yielded irrelevant results.

  • a) Did you map the controller to the component? And b) did you try removing the try-catch? – Sebastian Kessel Jun 14 '17 at 18:57
  • a) What do you mean by this? b) Yes. When I remove try-catch, the page will display a pop-up with the same error message upon button click. – Lightning Evangelist Jun 14 '17 at 18:59
  • I can't see the entire markup. Do you have <aura:component controller="xxx"> specified? – Sebastian Kessel Jun 14 '17 at 19:00
  • Ah, yes. The apex controller method I posted is a part of it. – Lightning Evangelist Jun 14 '17 at 19:03
  • I copy and pasted what you have in your description as a TestComponent and put it in a test app with only the component and it works as expected: components/c/TestComponent.js:10 ----------------> nextStage 0 components/c/TestComponent.js:16 ---------------> completeStage 1 components/c/TestComponent.js:20 ---------------> completeStage 2 – Scott Morrison Jun 14 '17 at 20:02
2

I suspect this error might be caused by a variety of issues, but as Tony White mentioned, I was encountering this in a concrete component that extended an abstract component, that extended another abstract component.

I fixed this issue by making sure the API versions of all three components were the same. The concrete component was set to an API version of 40, where as the other components were API 38 and API 39. Setting all versions to API 39 resolved it.

0

Sometimes the component gets corrupt and starts giving this issue as well. There is no mistake in your code just try calling the same things in a new component and I can assure it will work well.

  • Considering adding this to comments rather than answer. – dzh Jul 12 '17 at 2:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.