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.

11
  • a) Did you map the controller to the component? And b) did you try removing the try-catch? Commented Jun 14, 2017 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. Commented Jun 14, 2017 at 18:59
  • I can't see the entire markup. Do you have <aura:component controller="xxx"> specified? Commented Jun 14, 2017 at 19:00
  • Ah, yes. The apex controller method I posted is a part of it. Commented Jun 14, 2017 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 Commented Jun 14, 2017 at 20:02

2 Answers 2

3

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.

1
  • Thank you a lot! I had a similar issue, but the aura framework couldn't find the $getDef$ method on the action. I had version 39 on the abstract component and 53 on the inherited. Changing the version to 39 on the last one fixed the issue. Commented Dec 21, 2021 at 6:14
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.

1
  • Considering adding this to comments rather than answer.
    – dzh
    Commented Jul 12, 2017 at 2:46

You must log in to answer this question.

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