Node.js http get request exits early with foreman

EDIT: As has been pointed out, this code actually runs fine directly through Node -- I realise now that the problem is when I try to run it with foreman, which is part of the Heroku tool-kit. Does anyone know why I should get a different result when run with the foreman command?

I am trying to parse an XML feed using Node.js. I have code so far just to get the xml feed in chunks and output these to the console. For some reason, whenever I run it, I get an "exited with code 0" "sending SIGKILL to all processes" message at a random point (different at each run). The message comes interspersed with the last few lines of the xml (example end of output):

01:17:55 web.1  |     </item>
    01:17:55 web.1  | exited with code 0
    01:17:55 web.1  |     <item>
    01:17:55 system | sending SIGKILL to all processes
    01:17:55        |       <title>The Church of Scot

Does anyone know what might be causing this early exit? Here is my code

var http = require('http');
//var xml2js = require('xml2js');

var options = {
  host: '',
  port: 80,
  path: '/news/rss.xml'

var req = http.get(options, function(res) {
  //console.log('STATUS: ' + res.statusCode);
  //console.log('HEADERS: ' + JSON.stringify(res.headers));
  res.on('data', function (chunk) {
    console.log("\n\n new chunk \n\n");

req.on('error', function(e) {
  console.log('problem with request: ' + e.message);


Many thanks for your time and responses!




Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.