意外的meteorjs错误在将标头发送到客户端后无法呈现标头

时间:2015-12-02 09:46:37

标签: node.js meteor

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服务器仅抛出此错误或生产实例。我在Staging中运行相同的存储库,它运行顺利。即使没有人与客户端交互,流星也会抛出此错误(Crons在定期间隔期间在服务器上运行)。我无法弄清楚原因。人们已经针对不同的问题面对这个问题,但我并没有发现它对我的案例很熟悉。

我怀疑此代码会抛出此错误。不确定

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}});
}

0 个答案:

没有答案