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?
H
Harald Schlindwein
said
over 7 years ago
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.
M
Michael
said
about 7 years ago
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.
H
Harald Schlindwein
said
about 7 years ago
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
Harald Schlindwein
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;
logger.info('received action: '+request.body.action);
req.get({
uri: 'http://DATASTREAMINGSERVICE',
method: 'post',
timeout: 15000,
followRedirect: true,
maxRedirects: 10}, function(error, resp, body){
logger.info('sending request...');
if (error){
logger.error('error sending request: '+error.message);
response.body = {error: error.message};
response.complete(400);
return;
}
else {
logger.info('request successful');
response.complete(200);
}
});
}
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 ...in onRequest
"sending request..."
Any ideas what is wrong with my code?
Harald