question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IncomingForm end event emitted twice (at least)

See original GitHub issue

Support plan

  • Which support plan is this issue covered by? Community
  • Currently blocking your project/work? no
  • Affecting a production system? yes

Context

  • Node.js version: v14 and v16 at least
  • Release Line of Formidable: Current
  • Formidable exact version: 2.0.1 (npm)
  • Environment: node, macOS and Linux, does not matter
  • Used with (popular names of modules): express

What are you trying to achieve or the steps to reproduce?

let form = new formidable.IncomingForm();

form.on("field", (field, value) => {
    console.log("field", field, value);
});

form.on("end", () => {
    console.log("end");
});

What was the result you got?

Printed “end” twice.

What result did you expect?

Print “end” once. I tested with a simple Postman form with 2 fields.

I bypassed the error using form.once("end") but this doesn’t feel right.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
GrosSacASaccommented, Aug 11, 2022

@marcorocci true but the library should also not emit end twice to begin with

1reaction
LatenCcommented, Jan 19, 2022

Same issue happened with me also. I am also using the same version - 2.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

'end' event from readstream is emitted twice - node.js
I'm using similar code, although I'm watching for the close event on the writable stream, instead of the end stream of the readable...
Read more >
Formidable - npm
Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the...
Read more >
Events | Node.js v19.3.0 Documentation
When an error occurs within an EventEmitter instance, the typical action is for an 'error' event to be emitted. These are treated as...
Read more >
Node.js in Action
side of the event loop (outside the main script execution) and then an “event” is emit- ted when the I/O is finished,6 which...
Read more >
formidable
Support filename="" in multipart parts; Explain unexpected end() errors in parser better. Note: Starting with this version, formidable emits 'file' events ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found