Hi,

I have on my dedicated server, a node http server and a node script which 
is executed once each day.
The script check if there a new review, download some informations and then 
create an email with this information and send it to the email api of my 
node http server.

When the script is executed, I received this error

>  

[2013-01-08 16:13:39.187] [ERROR] DL REVIEWS - Request error

[2013-01-08 16:13:39.188] [ERROR] DL REVIEWS - { [Error: socket hang up] 
> code: 'ECONNRESET' }

Error: socket hang up

    at createHangUpError (http.js:1263:15)

    at Socket.socketOnEnd [as onend] (http.js:1351:23)

    at TCP.onread (net.js:418:26)


I use this code to send the request to my node http server (localhost)

> var opts = {

                                                host:'localhost',

                                                port:'8080',

                                                path:'/api/1.0/email.json?' 
> + encodeURI('from=No-Reply 
> <[email protected]>&[email protected]&subject=Reviews Download'),

                                                method:'POST',

                                                headers:{

                                                    
> 'Content-Type':'application/x-www-form-urlencoded',

                                                    
> 'Content-Length':body.length

                                                }

                                            };


>                                             logger.debug(opts);


>                                             var request = 
> http.request(opts, function (response) {

                                                var data = '';


>                                                 response.on('data', 
> function (chunk) {

                                                    data += chunk;

                                                });


>                                                 response.on('end', 
> function () {

                                                    data = JSON.parse(data);


>                                                     logger.debug(data);


>                                                     if (data.status.code 
> === 0) {

                                                        callback();

                                                    } else {

                                                        
> callback(data.status.message);

                                                    }

                                                });

                                            });


>                                             request.on('error', function 
> (err) {

                                                logger.error('Request 
> error');

                                                callback(err);

                                            });


>                                             request.write(body);

                                            request.end();


Any idea ?

Thank you.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to