parsing服务器(快速)错误:发送后无法设置标头

在NodeChef上运行的Parse Server上使用以下函数:

var sendMail = function(sendMailData) { return Parse.Cloud.httpRequest({ method: 'POST', url: 'https://api.sparkpost.com/api/v1/transmissions', body: { content: { from: 'noreply@domain.com', subject: sendMailData.subject, template_id: sendMailData.templateId, }, substitution_data: sendMailData.substitution_data, recipients: sendMailData.recipients }, headers: { 'Authorization': 'AUTHKEY', 'Content-Type': 'application/json' } }); } sendMail(defaultSendMailData).then(function(okresp) { var attemptedSend = false; if (request.user.get('config')) { var userConfig = request.user.get('config') if (userConfig.copyPrescription === true) { attemptedSend = true; sendMail(defaultSendMailData).then(function(okresp) { var attemptedSend = false; if (request.user.get('config')) { var userConfig = request.user.get('config') if (userConfig.copyPrescription === true) { attemptedSend = true; sendMail(copyPrescriptionSendMailData).then(function(okresp) { console.log('Woohoo! You just sent your first mailing 1!'); response.success("Great! Your program has been sent!"); }, function(errresp) { console.log('Whoops! Something went wrong 1'); console.log(errresp); response.error(errresp); }); } }; console.log('Woohoo! You just sent your first mailing 2!'); if (!attemptedSend) { response.success("Great! Your program has been sent!"); } }, function(errresp) { console.log('Whoops! Something went wrong 2'); console.log(errresp); response.error(errresp); }); }); } }); 

并得到以下错误:

 at Immediate.<anonymous> (/bundle/node_modules/express/lib/router/index.js:618:15) at Immediate.<anonymous> (/bundle/node_modules/express/lib/application.js:232:9) at next (/bundle/node_modules/express/lib/router/index.js:271:10) at Function.process_params (/bundle/node_modules/express/lib/router/index.js:330:12) at /bundle/node_modules/express/lib/router/index.js:280:7 at trim_prefix (/bundle/node_modules/express/lib/router/index.js:312:13) at Layer.handle [as handle_request] (/bundle/node_modules/express/lib/router/layer.js:95:5) at jsonParser (/bundle/node_modules/parse-server/node_modules/body-parser/lib/types/json.js:94:7) at next (/bundle/node_modules/express/lib/router/index.js:271:10) at Function.process_params (/bundle/node_modules/express/lib/router/index.js:330:12) at /bundle/node_modules/express/lib/router/index.js:280:7 at trim_prefix (/bundle/node_modules/express/lib/router/index.js:312:13) at Layer.handle [as handle_request] (/bundle/node_modules/express/lib/router/layer.js:95:5) at allowCrossDomain (/bundle/index.js:439:9) at ServerResponse.header (/bundle/node_modules/express/lib/response.js:719:10) at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:344:11) Error: Can't set headers after they are sent. 

虽然function似乎有效,但我担心这个错误以及它来自哪里。 我不相信这是Parse.com(我使用这个完全相同的代码)的情况。 这个错误不会出现在我的Parse.com日志中。 任何协助我的分析服务器生产部署实际上这个时候坚持(第三次尝试!)将不胜感激。

感谢上面的所有意见,试图解决这个问题。 我已经与Node Chef联系过,他说:

这个错误是由星期六的2.2.17parsing服务器更新引起的。

其他用户发现并报告了它,我们必须回滚更新。

目前,自动更新已closures,您可以随时从服务器设置>运行时设置手动更新服务器,确信新版本可以与您的应用程序配合使用。

回滚工作,我现在没有任何错误。