-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Callback called multiple times #423
Comments
Fixed after remove this lib from my dependencies and use |
I have the same "Callback called multiple times" each time I try to have the fast-csv parse stream pipe into another one... is this a fast-csv (new?) bug ? |
The same occurs with v4.3.1, v4.3.0, v4.2.0 and v4.1.6 |
@rhanka thank you for checking. These types of issues are sometimes hard to reproduce, I'll investigate shortly. |
I've identified the problem on this line: fast-csv/packages/parse/src/CsvParserStream.ts Lines 79 to 86 in 23bf809
It occurs in both _flush() and _transform(). The processRows() -> callNext() function calls the done() callback, and then is caught by _flush() and _transform(), where the done() callback is invoked again. The error was reproduced by parsing a CSV file containing duplicate headers. |
It looks like this may only occur when running from certain versions of Node. The following block will result in the reported error in Node v8.15.0. It does not cause a problem when running under the currently configured v14.8.0. const CSV_CONTENT = ['a,b,b,c', '1,2,2,3'].join(EOL,);
csv.parseString(CSV_CONTENT, {headers: true}) |
I've been receiving this same error while trying to parse a streamed csv file. The basic code is just: const someStreamFromS3 = ... ;
const myRecords = [];
csv.parseStream(someStreamFromS3).on("data", data => myRecords.push(data)); The error occurs regardless of whether I include an Node Version: 10.18.1 |
Just issue #464 to try to address this, instead of calling done again in the catch block it will now re throw the error. I'll update once I publish |
Just published Thank you for the bug report! |
Describe the bug
I'm currently using your lib to parsing a stream received from a S3 bucket. But after some time I've noticed the following error:
Parsing or Formatting?
To Reproduce
Here's the current coding that's triggering this error:
The lib isn't used in any other place.
Expected behavior
No error should occur during parsing process.
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: