Start a new topic

receiving SOCKETTIMEDOUT when requesting external http response


I need to read a stream as a response to a http POST.

If I send the request from a custom endpoint in Kinvey I get back a SOCKETTIMEDOUT while sending the same request from

my local node.js gives me the expected data.

My code:

function onRequest(request, response, modules){

var req = modules.request;

var logger = modules.logger;'received action: '+request.body.action);



method: 'post',

timeout: 15000,

followRedirect: true,

maxRedirects: 10}, function(error, resp, body){'sending request...');

if (error){

logger.error('error sending request: '+error.message);

response.body = {error: error.message};




else {'request successful');





just testing code so ingore the lack of beauty in it...

The log files entries are:

INFO 12:26:33 PM from request ... in onRequest

"received action: trigger endpoint"

ERROR 12:26:35 PM from request ... in onRequest

"error sending request: ESOCKETTIMEDOUT"

INFO 12:26:35 PM from request onRequest

"sending request..."

Any ideas what is wrong with my code?


When you curl to http://DATASTREAMINGSERVICE do you get back a response? Are you sure that your node.js code is identical, for example, are you sending a body?
cUrl gives me the expected response, almost instantly a header and data chunks with some delay, which is normal.

My node.js works with and without sending a body, I used http.request and the request modul, all combinations work.
The service is likely taking longer to respond than the time limit allocated to Business Logic. All business logic scripts must complete in 2000 ms, so a request with a timeout of 15000 that takes several seconds to complete will fail.
but that 2000ms second is not the problem. The header is received much faster than 2000ms and I receive even the esockettimedout faster than those 2seconds....I really think the missing body is the problem

Can we use kinvey with reactNative?

Login or Signup to post a comment