0

If I call req.file('files') and not calling updload (for example because I throw validation error) the app crashes.

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

error :

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)
Kreator
  • 59
  • 1
  • 11

1 Answers1

0

I was also facing the same issue, in my case, I checked with allParams() that will prevent app from crashing.

const fileDetials = !('image' in req.allParams()) ? req.file('fieldName') : '';
Alessio
  • 3,404
  • 19
  • 35
  • 48