Skip to content

node-clickhouse fails silently when used with "pipeline". #76

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

Open
paeolo opened this issue May 5, 2021 · 0 comments
Open

node-clickhouse fails silently when used with "pipeline". #76

paeolo opened this issue May 5, 2021 · 0 comments

Comments

@paeolo
Copy link

paeolo commented May 5, 2021

It's a common thing when dealing with streams to wrap them with a pipeline like so:

const { pipeline } = require('stream');
const { promisify } = require('util');
const ClickHouse = require('@apla/clickhouse');

const ch = new ClickHouse({ host, port, user, password });

let input = SOME_INPUT_STREAM;
let output = ch.query("SOME_QUERY");

await promisify(pipeline)([
    input,
    output
]);

There is a big issue here when using @apla/clickhouse, because in case of error the output stream will emit the finish event before the error event, so the promise will resolve (ie. will not reject).

So basically using @apla/clickhouse with pipeline will cause errors to fail silently!

To fix this issue the stream created by @apla/clickhouse query function should finish after having errored I guess.

@paeolo paeolo changed the title node clickhouse fails silently when used with "pipeline". node-clickhouse fails silently when used with "pipeline". May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant