function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MWorldMMMWorldMM 

Winter 12 breaks JS Remoting ?

We have Javascript Remoting in use in our Production instance (Summer '11) and it works like a charm. Our Sandbox was just "upgraded" to Winter 12 and now we are getting reference errors on code that has not changed in 2 months. What gives?

kpeterskpeters

After upgrading to Winter '12, we are seeing problems with our custom JS buttons not working that are using the ajax.cs and connection.js libraries.  Is this similiar to what you are seeing?

cwall_sfdccwall_sfdc

MWorldMM:  Can you provide a little more context?  What are the references errors?  Are there Javascript errors (see browser's Javascript console and/or Firebug)?

 

Thanks.

MWorldMMMWorldMM

This is the logged error:

 

Uncaught ReferenceError: AutoCompleteController is not defined
$.autocomplete.source
$.widget._searchjquery-ui-1.8.13.custom.js:5157
$.widget.searchjquery-ui-1.8.13.custom.js:5150
$.widget._create.element.addClass.attr.attr.bind.bind.suppressKeyPressjquery-ui-1.8.13.custom.js:4955

down arrow: $.autocomplete.source
$.widget._searchjquery-ui-1.8.13.custom.js:5157
$.widget.searchjquery-ui-1.8.13.custom.js:5150
$.widget._movejquery-ui-1.8.13.custom.js:5253
$.widget._create.element.addClass.attr.attr.bind.bind.suppressKeyPressjquery-ui-1.8.13.custom.js:4924
jQuery.event.handlejquery-1.5.1.js:2562
jQuery.event.add.elemData.handle.eventHandle

 

Basically, the auto-complete works intermittently - only after there is an error message displayed on the page. This is completely new behavior since W '12 went into our Sandbox.

cwall_sfdccwall_sfdc

Tough to speculate w/o digging deeper.

 

I assume AutoCompleteController is your controller w/ remoted methods.  If the remoted method is being invoked intermittently (by that, do you mean that it always works after the error?), that makes me think that autocomplete is being invoked before the remoting configuration is applied to the page.

 

When you look at the DOM (via Firebug), does the Javascript object "window.AutoCompleteController" exist and does it have methods corresponding to your @RemoteAction methods?  When you viewsource on your page, in the <head> tag do you see your controller's remoting configuration (JSON format; search "RemotingProviderImpl")?

 

I tried the JQuery Autocomplete source from the following blog in a Winter '12 org.  Works as explected.  What does your .autocomplete configuration look like?

http://verticalcode.wordpress.com/2011/02/19/salesforce-javascript-remoting-jquery-and-autocomplete/

MWorldMMMWorldMM

Yes, AutoCompleteController is the APEX behind our AutoComplete component.

 

With regards to the error displayed on the page let me clarify:

 

The field that we use autocomplete on is required; therefore if you click continue without having a value in the auto-completed field the page refreshes and displays a page message. At that point, the auto-complete starts to work. This would seem to indicate that W'12 changed something about how the remoting or related JS is loading. As in it's not loading immediately as it did before.

 

In answer to your questions:

 

Yes, I do find AutoCompleteController with the remote action methods in both Production and Sandbox. I do not find "RemotingProviderImpl' in the head of either place.

MWorldMMMWorldMM

Let me correct what I said above. AutoCompleteController does NOT show up in the initial load of the page in the W'12 Sandbox but does show up in the intial load of the Su'11 Prodiuction instance. If the page is refreshed as a result of a Page Message (as described above) then AutoCompleteController appears in the Sandbox.

cwall_sfdccwall_sfdc

Are you able to post your page/component source?

 

I'd suggest opening a suport case.  With the case we'll be able to dive deeper into your org.

cwall_sfdccwall_sfdc

Update on this issue?  Workaround?  Created Support case?

MWorldMMMWorldMM

We've the issue go away completely for a while and then return, randomly. No code changes on our end so it's clearly infrastructure. It's Browser and platform independent as well. Since it's not an issue in our production instance at this point, I'm working on different one that is - 'Processing Time Exceeded' when using pageReference.getContentAsPDF. I seem to be the king of weird errors. ;-)

cwall_sfdccwall_sfdc

Thanks for the update.

 

Can you create a support case so we can look more indepthly at the issue?

MWorldMMMWorldMM

Done. Case #06285668

hemantgarghemantgarg

 

Same is happening in our case though, breaks remote action, now the remote action returning into an error saying "Unable to connect to the server" . I am shocked to see this error. It is not documented anywhere nor discussed much in blogs.

Dev supportDev support

Hi All,

 

This is a known issue for some reason using JS Remoting from within a VF component looses reference to the component's controller and that causes the call to the controller's method to fail.

As a workaround the you can specify the class that contains the remote functions as a VF controller extension in the main VF container form. This does require adding the appropriate constructors to the class with the remote functions.

 

Regards,

Dev support

 

hemantgarghemantgarg

It is also unstable solution, sometimes it does not connect and gives error saying "unable to connect to server" . 

cwall_sfdccwall_sfdc

@

 

 

 

hemantgarghemantgarg

Yes, I created a support case and got a reply that this is a known issue right now and will be fixed in next release. I am not sure that it is only for certain instances or for all. But on sandbox there is no such issue.

On production also it works sometime and failing sometime.

seattle_devseattle_dev

I am also getting this same issue. The javascript remoting function that i use to count records works most of the time, but in the morning when first performing the operation it will return the error "Cannot connect to server" for about two or three tries, then after receiving the error two or three times, it will work fine.

 

Have you made any progress with resolving this @hemantgarg?

ganesh jadhavganesh jadhav

hi iam facing the same problem when i insert more than one records

Unable to connect to the server (communication failure).