4

I am using formidable module https://github.com/felixge/node-formidable to upload images. I created a separate new project & file upload works perfectly.

But when i integrate it in my existing project. I get following error :-

Error: Request aborted
at IncomingMessage.onReqAborted (D:\ProjectName\node_modules\express\node_modules\connect\node_modules\multiparty\index.js:131:17)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at abortIncoming (http.js:1911:11)
at Socket.serverSocketCloseListener (http.js:1923:5)
at Socket.EventEmitter.emit (events.js:117:20)
at TCP.close (net.js:466:12)

Any idea How to Solve this?

I tried ON event :-

form.on('progress', function (bytesReceived, bytesExpected) {
        console.log('PROGRESS');
        console.log(bytesReceived);
        console.log(bytesExpected);
    });

It gives me result for above code as :-

PROGRESS
0
488

It doesn't go ahead of this.

Anup
  • 9,396
  • 16
  • 74
  • 138

3 Answers3

0

try to delete this in your app.js:

app.use(express.bodyParser());
Jerry Lee
  • 9
  • 1
  • 1
    Can you explain why deleting this would help? i thought body parser is needed to get the req of a post request? – Kay Aug 30 '19 at 09:48
0

It might be little late for OP, but for others: just set/increase the nodejs timeout like so:

server.timeout = 1000 * 60 * 10; // 10 mins

formidable uses this setting after which it throws the "abort" and "error" event. you can check this answer for details

Community
  • 1
  • 1
martin
  • 56
  • 1
  • 5
  • I had the problem with fluent-ffmpeg processing taking too long (more then default setting of 2 minutes) which resulted in _Request aborted_) – martin Jul 07 '15 at 15:39
0

For later versions of express (i.e. express@^4.x) where body-parser is deprecated, delete, remove or comment out any app.use(express.json()) in your entry .js or .ts file.

Memphis
  • 79
  • 1
  • 6