node.js EPIPE error

395 views
Skip to first unread message

Jacob Lyles

unread,
Jun 14, 2012, 1:32:32 PM6/14/12
to nod...@googlegroups.com
Hi all,

I have a nodejs script which fetches an xml file from a web server, parses it, then stores some data in a mongodb database. When I run it at the command line, it works fine 100% of the time. However, when I run it as a cron job, it throws an exception partway through. I redirect stderr to error.txt and I get the following error.txt:

events.js:48
        throw arguments[1]; // Unhandled 'error' event
        ^
Error: write EPIPE
    at errnoException (net.js:670:11)
    at Object.afterWrite [as oncomplete] (net.js:503:19)


Could someone point me in the right direction to fix this? 

Thanks,
Jacob

Matt

unread,
Jun 14, 2012, 1:44:56 PM6/14/12
to nod...@googlegroups.com
You need to add an .on('error', ...) handler somewhere.

Matt.


--
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 nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Yuri Teixeira

unread,
Jun 14, 2012, 3:27:10 PM6/14/12
to nod...@googlegroups.com
Show us how you execute it on your command line and how you execute it as a cronjob (including which user executes the script in both cases).

Best Regards,

-- 
Yuri Teixeira
Sent with Sparrow

Reply all
Reply to author
Forward
0 new messages