0
http.js:732
    throw new Error('Can\'t render headers after they are sent to the client.'
    ^
Error: Can't render headers after they are sent to the client.
    at ServerResponse.OutgoingMessage._renderHeaders (http.js:732:11)
    at ServerResponse.writeHead (http.js:1153:20)
    at ProxyServer.<anonymous> (/home/ec2-user/.meteor/packages/meteor-tool/.1.1.4.1tjewoi++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/tools/run-proxy.js:96:21)
    at ProxyServer.emit (/home/ec2-user/.meteor/packages/meteor-tool/.1.1.4.1tjewoi++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/http-proxy/node_modules/eventemitter3/index.js:100:27)
    at ClientRequest.proxyError (/home/ec2-user/.meteor/packages/meteor-tool/.1.1.4.1tjewoi++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:140:16)
    at ClientRequest.emit (events.js:117:20)
    at Socket.socketOnData (http.js:1593:9)
    at TCP.onread (net.js:528:27)

Meteor server throws this error or Production instance only. I'm running the same repository in Staging and it runs smoothly. Meteor throws this error even when nobody is interacting with the client (Crons run on server during regular intervals). I'm not able to figure out the reason. People have faced this problem for different issues, but I didn't find it familiar with my case.

I suspect this code is throwing this error. Not sure though

updateFunction = function(event) {
    var res =  Meteor.http.call("GET", "http_url"+ event);
    var contents = EJSON.parse(res.content).tracks["0"];
    if(!contents) return;
    var events = [];
    contents.map(function(ele){
            if(ele.type == "snap") {
                ele._id = ele.id;
                delete ele.id;
                events.push(ele);
            }
    });
    CollectionName.upsert(event,{"$set":{"data": events}});
}
prgmrDev
  • 910
  • 1
  • 10
  • 20
  • Can you also paste some of your code which is causing this ... ? – Chandan Dec 02 '15 at 10:03
  • basically, this happens when data is already sent to the client and code is again trying to send it .. – Chandan Dec 02 '15 at 10:13
  • you can have a look at this - http://stackoverflow.com/questions/7042340/node-js-error-cant-set-headers-after-they-are-sent?rq=1 – Chandan Dec 02 '15 at 10:17

0 Answers0