【问题标题】:Sails app crash when not calling skipper uploadSails 应用程序在不调用船长上传时崩溃
【发布时间】:2020-09-20 16:17:27
【问题描述】:

如果我调用req.file('files') 而没有调用updload(例如因为我抛出验证错误),应用程序就会崩溃。

const files = req.file('files')
if (!files || files.length === 0) {
  throw "MISSING_ARGUMENTS"; // intentally fails here
}
file.upload() // not reaching here

错误:

events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: EMAXBUFFER: An Upstream (`NOOP_files`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.
    at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:86:15)
    at listOnTimeout (timers.js:327:15)
    at processTimers (timers.js:271:5)
Emitted 'error' event at:
    at Upstream.fatalIncomingError (../node_modules/sails/node_modules/skipper/standalone/Upstream/prototype.fatalIncomingError.js:95:8)
    at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:93:12)
    at listOnTimeout (timers.js:327:15)
    at processTimers (timers.js:271:5)
Waiting for the debugger to disconnect...
Error: EMAXBUFFER: An Upstream (`NOOP_files`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.
    at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:86:15)
    at listOnTimeout (timers.js:327:15)
    at processTimers (timers.js:271:5)
Emitted 'error' event at:
    at Upstream.fatalIncomingError (../node_modules/sails/node_modules/skipper/standalone/Upstream/prototype.fatalIncomingError.js:95:8)
    at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:93:12)
    at listOnTimeout (timers.js:327:15)
    at processTimers (timers.js:271:5)

【问题讨论】:

    标签: sails.js sails-skipper


    【解决方案1】:

    我也面临同样的问题,就我而言,我检查了allParams(),这将防止应用崩溃。

    const fileDetials = !('image' in req.allParams()) ? req.file('fieldName') : '';
    

    【讨论】:

    • 用你的字段名替换图片
    猜你喜欢
    • 2015-02-21
    • 2014-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    相关资源
    最近更新 更多