It take some time for the method in Apex to become visible for the lightning component. What is a workaround here?

I mean literally: I create an Apex controller, create a method in it, then I create a lightning component and in its client-side JavaScript controller perform a request to the Apex controller. I am getting an error that there is no such method in Apex controller. Then after some time (usually it is from instantly to a few hours period) the function becomes visible.

I see no point to post code here, I am just performing a standard lightning-component to Apex communication every time and I do not have a specific problem, just a recurring one.

In some cases I noticed (but I can not prove it) that if I change a return type of an Apex function, then try to call it from a lightning-component and then change the return type, the function is called successfully.

I just thought that maybe someone else is having the same problem and may suggest something here.

I just checked the Enable secure and persistent browser caching to improve performance in the Session Settings of the org where the problem takes place. And the caching was disabled all this time, hence the problem is different from the one described here.

The problem happens in a Developer Edition org.

I can not find the following setting: Setup -> Lightning Components -> Enable Debug Mode checked. I mean the Enable Debug Mode checked part. What am I missing here?

enter image description here

  • 2
    See/tried this: salesforce.stackexchange.com/a/146605/9853 ?
    – Girbot
    Commented Aug 24, 2018 at 17:49
  • Sounds exactly like a caching problem, maybe with a slow compiler in the mix? Commented Aug 24, 2018 at 18:18
  • @battery.cord, what compiler are you talking about?
    – iloveseven
    Commented Aug 24, 2018 at 18:30
  • After you save a file, but before its cached, salesforce has to compile it, turning it into bytecode understood by the actual platform machines. The resulting code is cached for use by the org. See this video for a detailed description of each step. If caching isn't enabled, its likely the org's resources are being shared (very likely if its a sandbox) and compiling/caching is delayed due to the volume of requests. Commented Aug 24, 2018 at 19:15
  • 2
    Just another data point that I have never experienced this either. Sounds to me like either the problem is being misinterpreted (i.e. the class did not really save) or there is an issue on the pod you are working in.....
    – Eric
    Commented Aug 26, 2018 at 3:19


You must log in to answer this question.

Browse other questions tagged .