1

Every time a new server-side method is added to existing component that has controller tag and it's successfully calling other methods in the same class, that component has an issue with recognizing the new method and I feel that voodoo needed to resolve this every time.

Sometimes I close the Developer Console and it starts to recognize the method, sometimes I logout/login multiple times, sometimes saving the component without the controller tag, rendering it a few times and then setting back the controller works, but sometimes not. At the end, I'm wasting sometimes hours saving all these files logging out and in to get this to work.

It feels like there's some weird caching issue, but I have no idea where it might come from.

The error I'm getting is

"Unable to find action 'myNewMethod' on the controller of c:myCmp"

myCmp.cmp

<aura:component controller="myCtl">
    ....
</aura:component>

myCmpController.js

...
{
    myFunction: function(cmp,event,helper){
        var a = cmp.get('c.myNewMethod');
        a.setCallback(this,function(r){
            ...
        });
        $A.enqueueAction(a);
    }
}
...

myCtl.cls

...
@AuraEnabled
global static boolean myNewMethod() {
    return true;
}
....

Does any one else having this issue and knows how to resolve this?

3

Under setup -> Session setting there is an option you need to disable. Something to the effect of “enable persistent caching to improve performance “

  • That one is disabled long time ago, so it's not that – alechko Feb 6 at 8:08
1

We had the same issue at my workplace, But steps to fix it are always different. I will list out all the steps we performed to fix it.

  1. @Eric's Solution is the first one to try, it will fix it sometimes.
  2. Go to Setup -> Develop -> Apex Classes, and Click "Compile All Classes".
  3. Remove action.setStorable() in the Lightning method if you are using it.
  4. Go to Browser Console from your Lightning Component. In the Application Tab. Clear the Cookies, Storage, Site Data etc...
  5. Run the test class of that @AuraEnabled method's class. Make sure you have a unit test for that method.

Usually, these steps will work for us. Try them and let me know if it fixed your issue.

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.