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
RockjackRockjack 

remoteFunction returning Read Timeout

I have an s-control that uses the AJAX proxy remoteFunction to connect to an external URL.  It has been working correctly for several months.  Over night the remoteFunction stopped working and only returns a read timeout error.
 
"400 Unable to forward request due to: Read timed out"
 
 I have eliminated and/or tested all of the other factors: connection to external site, browser, data error, IP address whitelists, etc.  I have tried using version 11 and 12 of the API.  I have also contacted the Sales Force support line with no avail.  I know that this can occur when Sales Force slows down, but it has never happened for this long 12+ hours.
 
I am left to assume that some issue with Sales Force occurred over night.  Any Ideas?
 
Code:
function postRequest(envelope) {

 sforce.connection.remoteFunction({
  url : "https://<deleted>",
  requestHeaders: {
   "Content-Type":"application/x-www-form-urlencoded; charset=utf-8"
  },
  requestData: envelope,
  method: "POST",
  onSuccess : postSuccess,
  onFailure : postFailure
 });

} 

cheenathcheenath
External server that you are invoking is running slow?

I just tried this and it is working fine:

sforce.connection.remoteFunction({
  url : "http://www.cheenath.com",
  method: "GET",
  onSuccess : function (result){alert(result)},
  onFailure : function (error) {alert(error)},
 });




RockjackRockjack

Thanks for the response.  I tested our site connection this morning and it responded within 1-2 seconds.

I am going to reboot the firewall for our external site to see if that makes a differance.  Possibly the server as well if the firewall reboot doesn't help.

I'll be able to tell fairly quickly.

Clay

RockjackRockjack

Unfortunately, rebooting the server and firewall on our external site didn't work.  We are still getting the "400 Read timed out" error.  We have tried everything we can think of.

Something must have changed over night for the remoteFunction to stop working after working for several months and many transactions.  The only other time this has occurred is when Sales Force connections get slow in the afternoon.

I'll keep working on it.

If any body has any other ideas please let me know.

Clay



Message Edited by Rockjack on 06-19-2008 04:49 PM
jeremy_wjeremy_w
I'm getting the same thing: read timeout and this started happening yesterday.
I've also checked the site it's going to - it responds instantly and have even tried it by returning a single string to avoid any doubt in processing times.

Perhaps this is to do with the HTTPS rather than HTTP as I'm only using HTTPS requests?

I think it's definitely something on the Salesforce side.


cheenathcheenath
HTTPS is also working fine for me:

sforce.connection.remoteFunction({
  url : "https://www.salesforce.com",
  method: "GET",
  onSuccess : function (result){alert(result)},
  onFailure : function (error) {alert(error)},
 });


Please contact support. I am not sure what is going wrong in your case.



mshelmanmshelman
We are also experiencing the Read Timeout failure for a remoteFunction call that has been working fine for months which I would think supports the idea that it is a Salesforce problem. Interestingly, we are using two different remotefunction calls (to different services) and while one is consistently returning Read Timed Out the other is still functioning correctly. Maybe somehow the allowable time out period has changed on salesforce server?

Mike
cheenathcheenath
Timeout did not change at sfdc. Is the problem with HTTPS endpoint?

Your request type is GET or POST?



mshelmanmshelman
The call that is timing out is HTTP POST and is a form submission. When I test it from a browser it succeeds in a timely fashion. The call that is succeeding is HTTPS POST and is a SOAP call.
jeremy_wjeremy_w
Mine are HTTPS POSTS and still are failing.
If it's some sites (as some are suggesting) and not all, perhaps it's a routing issue from SF servers? I'm on the European server: emea.salesforce.com

I have not logged this with SF support:I find this quite a challenge - emails do not get replied to and the online service doesn't get an intelligent response either. Especially whenever it's to do with any custom code which SF is pushing us to write!

Somehow there should be a way to log these system problems rather than use this discussion board.


jeremy_wjeremy_w
I've found that using HTTPS GET works ok, but HTTPS POST does not.
It's possible that I'm not posting correctly (although it has been working fine for a month until the other day).

If someone can try the HTTPS POST, it would be useful to see if it works for them.

Thanks.


RockjackRockjack
As of this morning, I have not been able to get an HTTPS POST request to work.  I get the same error.
 
I called support last week and logged a case and it is still open.  I added more comments to the case regarding the above discussion as well.
 
I encourage everybody who is having this same problem to log a case.  Maybe we'll get some action.
 
Thanks
 
Clay
jeremy_wjeremy_w
I think it would be really useful if someone from Salesforce tried to do an HTTPS POST (with a few fields to post) and if successful, put the code on here to make sure we are using this functionality correctly. I've not found a good example of a POST with parameters to verify against.

cheenathcheenath

This seems to work fine for me:

sforce.connection.remoteFunction({
  url : "http://cheenath.com/tutorial/sfdc/sample2/echo.php?a=b",
  method: "POST",
  requestData: "userid=joe&password=guessme",
  onSuccess : function (result){alert(result)},
  onFailure : function (error) {alert(error)},
 });



daveespodaveespo
I'm having this same problem and it actually appears to be IE vs. Firefox ... IE fails (both IE6 and IE7) while Firefox works smoothly. I have setup a packet trace on my web server (the endpoint that the remoteFunction() call is invoking) and it appears as though the POST body is empty. The Content-Length header is correct (i.e. it's the size of what the POST payload should be), but there is no body that follows behind.

I have traced through the javascript code (connection.js) and it appears as though the body of the POST is properly submitted to the Salesforce proxy URL so it's somewhere inside of Salesforce that the body gets messed up before being sent to the remote endpoint.

In addition, I have found these two HTTP headers arriving at my web service endpoint that do NOT arrive for properly formed (non-truncated) requests. Not sure if it helps:

salesforceproxy-sid: 4c3200D400000009Ddg!AR0AQPyCenj_QS0_Q5AvrnCR9QYl0raZ67SldW2U8wy3oMk9TA80_4TmTTMR2gDUpvoCvgJeGt5VYCX_xSM1Pbf4Tcsqikjf

salesforceproxy-endpoint: <the URL to my endpoint>

Thanks,
Dave
jeremy_wjeremy_w
I've done some more testing with the following results:

Code:
sforce.connection.remoteFunction( {
 url :"http://domain/page",
 method: "POST",
 requestData: "a=aaaa&b=bbbb&c=cccc&d=dddd",
 async: true,
 onFailure : failed,
 onSuccess : done
});

Above code appears to work OK as there is no timeout, however the parameters are not posted to the website. Even though they appear in the POST as "a=aaaa&b=bbbb&c=cccc&d=dddd" (when checking with firebug).

Code:
sforce.connection.remoteFunction( {
 url :"http://domain/page",
 mimeType: "text/plain",
 requestHeaders: {"Content-Type":"application/x-www-form-urlencoded"},
 method: "POST",
 requestData: "a=aaaa&b=bbbb&c=cccc&d=dddd",
 async: true,
 onFailure : failed,
 onSuccess : done
});

The above code results in a timeout error and the website never gets contacted. In this case the POST request contacts each parameter on seperate lines like this:
a aaaa
b bbbb
c cccc
d dddd

So I'm still confused - what should the requestHeaders be? Either way there seems to be a problem.

cheenath - do you see the parameters you post to your web page from the web page?

edit: by the way I've only tried this on Firefox.






Message Edited by jeremy_w on 06-24-2008 01:31 PM
dptr1988dptr1988
I'm having getting the same '400 Unable to forward request due to: Read timed out' error message from the SF proxy.

One thing that is that the HTTP POST request will work if the "Content-Type" is set to "text/xml" or "text/plain". But the PHP script that receives this POST request requires a proper 'application/x-www-form-urlencoded' header and that somehow causes the SF proxy to timeout.

It works the same every time. If it set the "Content-Type" header to 'text/xml', the SF proxy handles the request just fine, but if I set the "Content-Type" header to ''application/x-www-form-urlencoded', the SF proxy times out.

Code:
 sforce.connection.remoteFunction({
  url: settings.XML_API,
  requestHeaders: { "Content-Type": "application/x-www-form-urlencoded" },
  requestData: "xml=" + escape(data),
  method: "POST",
  onSuccess: success_callback,
  onFailure: function failure(response) {
   alert('Could not contact "' + settings.XML_API + '" Please make sure that the URL is correct.');
   //window.close();
  }
 });

 
The PHP script that handles this POST request is working correctly and is not timing out or sending back very much data ( it's just a couple lines of XML ). So I'm pretty sure its a SF proxy or AJAX Toolkit issue.

cheenathcheenath
This looks like a bug. I filed one: Bug #192181



mshelmanmshelman
FWIW we have a case open for this issue that is supposedly being worked: Case: 01937347

Mike
dptr1988dptr1988
When you say that it is 'supposedly being worked', what do you mean? Has they acknowledged that the bug exists and they are finding a solution to it, or are they still trying to decide if it's a bug or not? Or are they just saying that to get us to stop bothering them.

I opened a case for this problem ( and linked to this thread, so they could see what others were experiencing ), and the guy that was handling my case told me that he had determined that the cause of my problem was ( in his exact words and spelling ) "that yore firewall is interfering with your HTMl code.  This is why you are timing out."

I'm not even using any HTML code yet, I'm just working with JavaScript and the Ajax toolkit. So I don't know what he meant by that.

Also if it was a firewall issue, then why would just changing the 'Content-Type' header cause it to work or time out based on that header?

I tested the code with other ( reliable ) servers, and got the same results. So if it is a firewall issue, then there are a LOT of other people need to fix their firewalls :smileyvery-happy:

I'm pretty sure that he made a mistake, but if he is right, could someone else explain what he meant?

Peter
cheenathcheenath
Yes, this is a bug and we are able to reproduce it locally.
We are working on a fix for it.

It took longer to resolve because we were not able to
reproduce the problem, till someone pointed out the
problem is specific to application/x-www-form-urlendoded
content type.

Thanks,


dptr1988dptr1988
I have been testing the 'remoteFunction' method every few days to see if had been fixed yet, and today it has been working!

Has this bug been fixed?

Was the bug in the server-side proxy or was it in the AJAX toolkit? If it was in the AJAX toolkit, do I need to use a specific version of the toolkit?

Or has this bug not been fixed yet, and the code just started to work for no reason at all?

Thanks
Peter

jeremy_wjeremy_w
I'm getting a read timeout again on this.
Can someone from Salesforce investigate to see if this bug has been fixed  (as it doesn't seem to be) or is still in progress.

Thanks.

error:

400 Unable to forward request due to: Timeout waiting for connection




Message Edited by jeremy_w on 08-26-2008 01:59 AM
jeremy_wjeremy_w
Looks like this is OK now. Nothing has changed and it works.
Seems to be a bit erratic.

da2nada2na

Hi Cheenath,

 

Has this bug been fixedI am still receiving a 400 "Read timed out error" when the "Content-Type" is set to "multipart/form-data".  Any updates, would be greatly appreciated.

 

-Thanks

mshelmanmshelman

The issue addressed in this thread, which was fixed in August 2008, has recently cropped up again. We are again experiencing "400 Unable to forward request due to: Read timed out" when running the same form submission thru remotefunction that was originally complained about.

 

Currently the form post is actually successful but returns the above error. This is different from the previous case where the post failed.It is not a file upload but a form post that has been working for several years (except when it has not.)

 

Somehow the issue got fixed last year so hopefully that could happen again. According to cheenath it is Bug #192181. Our case # was 01937347.

 

 

panipani

Can I get a update of this issue. I am still getting Read time out error when I am trying to upload a file to 3rd part services. But other services like getToken, login (post method), logout works perfectly using the same remoteaction method. 

 

So any help is really appreciate. 

panipani
function uploadDoc() {
 
var fd = new FormData();
var file = document.getElementById('filedata').files[0];
fd.append("filedata", file);
fd.append("filename", file.name);
fd.append("holidex", 'ABCD');

sforce.connection.remoteFunction({
url : '<https://endpointurl.com>',
requestData: envelope,
requestHeaders: {"Authorization": "Basic XXXXXXXX=", "Content-Type" : "multipart/form-data"},
method: "POST",
onSuccess : function(response) {
alert("Success " + response);
},
onFailure : function(response) {
alert("Failed " + response);
}
});

 

I am still getting the readtimeout error. Any help is really appreciate. 

 

FYI.. I am trying v25.0 connection.js

 

Console stack trace

 

quest Headers 
POST /services/proxy?no-cache=1345227502557 HTTP/1.1 
Host: c.ap1.visual.force.com 
Connection: keep-alive Content-Length: 11939 
Origin: https://c.ap1.visual.force.com 
Authorization: Basic XXXXXX= 
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.75 Safari/537.1 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjj29N1oBJHgV4aKW 
SalesforceProxy-Endpoint: https://desturl.com 
SalesforceProxy-SID: 00D90000000IWeW!ARkAQN63iqZcYZwKo_nfMkgC5E4YSFIr6mU50Oq5aCLv7lab73t1MVXsAYE1W_BvS3VpijDj_E5.EJGEwUp1ZGJgZAVmWMpP 
Accept: */* Referer: https://c.ap1.visual.force.com/apex/sample?core.apexpages.devmode.url=1 
Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: s_cc=true; s_sq=salesforcewiki%2Csalesforceadnrollup2%3D%2526pid%253DOOTBE%252520Start%252520Here%2526pidt%253D1%2526oid%253Dhttps%25253A//na14.salesforce.com/servlet/servlet.Integration%25253Flid%25253D01rd0000000INrt%252526ic%25253D1%2526ot%253DA; autocomplete=1; sid=00D90000000IWeW!ARkAQLez8sbzQwE7avGA_3endB2o9EiXIoI_kVjHtdtVYq6CnWOI9QOiOb3HLtVwUlVdCrLW5LH0dYd2LaaQDLcGN38BuyYT; sid_Client=0000000JNMc0000000IWeW; 
clientsrc=117.192.16.196; umps_clientId=203385-00590000000JNMc; webact=%7B%22l_vdays%22%3A0%2C%22l_visit%22%3A1345220771646%2C%22session%22%3A1345223989244%2C%22l_search%22%3A%22%22%2C%22l_dtype%22%3A%22External%20Websites%22%2C%22l_page%22%3A%22APPX%3Aus%3Asetupmodule%22%2C%22counter%22%3A24%2C%22pv%22%3A1%2C%22f_visit%22%3A1344268062640%2C%22version%22%3A%22w172.1%22%7D; inst=APP9; BIGipServercms-web-pool=719458476.36895.0000
Query String Parametersview URL encoded
no-cache:
1345227502557
Request Payload
------WebKitFormBoundaryjj29N1oBJHgV4aKW Content-Disposition: form-data; name="filedata"; filename="content-service.wsdl.txt" Content-Type: text/plain ------WebKitFormBoundaryjj29N1oBJHgV4aKW Content-Disposition: form-data; name="filename" content-service.wsdl.txt ------WebKitFormBoundaryjj29N1oBJHgV4aKW Content-Disposition: form-data; name="holidex" ABCD ------WebKitFormBoundaryjj29N1oBJHgV4aKW--
Response Headersview source
Cache-Control:
private
Content-Type:
text/html
Date:
Fri, 17 Aug 2012 18:18:32 GMT
Server:
 
Transfer-Encoding:
chunked

 

 

Response 

 

<html>
<head><title>400 Unable to forward request due to: Read timed out</title></head>
<body>
<h1>400 Unable to forward request due to: Read timed out</h1>
<p /><hr />
<small>

</small>
</body></html>

 

 

 

almazanjlalmazanjl

Hi.

 

Try this solution. Valid for servers that only support binary content and for servers that support base64 encoding.

 

http://salesforceafondo.wordpress.com/2013/01/08/post-multipartform-data-out-of-salesforce-com-with-...

 

Hope this helps.

 

José Luis Almazán.