4

"Visualforce Remoting: Javascript proxies were not generated for controller xyz: may not use public remoted methods inside an iframe." Getting this error when I am using my pages in Lightning. I am getting this wherever I have used remote actions. If I make remote actions global this error is gone. But I don't want this as solution because, to make all remote actions global I need to make classes as global also. Works fine in Salesforce Classic

3 Answers 3

2

This issue is not because of remote actions basically. Wherever we were calling remote actions using html tags in vf page, we were getting this error. We replaced html tags with apex tags (commandlink) and didn't change the remote actions. It works fine now. Html tags are not supported in lightning and error is bit misleading.

0

You shouldn't be calling visualforce controller methods from lightning origins. Call AuraEnabled lightning methods from lightning origins, and Javascript Remoting methods from visualforce origins. Also you should never pass the session id across these boundaries, either. Lightning and visualforce have different security policies -- one relies on iframes, the other on Locker. One gives you an API enabled session id and the other does not.

To call remote methods from a different origin requires creating something like a globally accessible webservice, which of course has to be marked global.

6
  • I have an existing fully developed application which is supporting Salesforce classic. I want to make it lightening compatible now but I get this error for almost all the pages because of the remoting methods. Separately creating AuraEnabled lightning methods will be altogether a new implementation Commented Oct 24, 2016 at 13:54
  • Yes, that's what it takes. Unfortunately you are talking about two different languages and porting work is required. This could be mitigated with some tooling to auto-rewrite sources, but there is no button that you can press to convert a lightning app into a visualforce app or vice versa. Commented Oct 24, 2016 at 13:56
  • lol ... we require it urgently, so I wish there was a button like that .. :) Anyways, thanks for the details. Commented Oct 24, 2016 at 13:59
  • To add another comment, Salesforce is excellent about keeping your old app working. Even S-Control based apps still work today. You don't need to rewrite anything to keep existing functionality. But if you want to migrate from one technology to another, then that requires some porting to use the new technology. In this case, changing \@RemoteAction to \@AuraEnabled is not a big ideal. The work is on the client, creating lightning components. Commented Oct 24, 2016 at 14:02
  • 2
    @RobertSussland The question mentions use of VF .Changing classes is fine but with auraenabled it will take some time for author to convert VF markups to lightning component and also rewire all logic via JS controllers Commented Oct 24, 2016 at 15:51
0

This is expected behaviour since lightning puts your visualforce inside an iframe .If your page is inside an iframe and calls a remoting function ,the class and method needs to be global and there is no alternative due to security restrictions

1
  • Yes. I get the concept behind. Just wanted to make sure if there isn't some other way out. This will need so many classes to be global as I am getting this error for all the pages in my application. Commented Oct 24, 2016 at 13:17

You must log in to answer this question.

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