Issue with pg-query-stream dest.on is not a function
See original GitHub issueUsing the example code in pg-query-stream, you get an error that dest.on is not a function.
Here is my code:
const pg = require('pg')
const QueryStream = require('pg-query-stream')
let p = new pg.Pool({host: 'localhost', user: 'postgres', database: 'postgres'})
p.connect((err, client, done) => {
if (err) throw err;
const query = new QueryStream('SELECT * FROM generate_series(0, $1) num', [1000000])
const stream = client.query(query)
//release the client when the stream is finished
stream.on('end', done)
stream.pipe(console.log)
}
and I get the following error:
Uncaught TypeError: dest.on is not a function
at PgQueryStream.Readable.pipe (_stream_readable.js:714:8)
at PendingItem.callback (repl:7:10)
at Pool._acquireClient (/home/nhumrich/project/node_modules/pg-pool/index.js:267:21)
at /home/nhumrich/project/node_modules/pg-pool/index.js:230:21
at Connection.<anonymous> (/home/nhumrich/project/node_modules/pg/lib/client.js:234:7)
at Object.onceWrapper (events.js:411:26)
at Connection.emit (events.js:316:22)
at Connection.EventEmitter.emit (domain.js:545:15)
pg-query-stream version 3.0.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What does this mean: TypeError: dest.on is not a function
1 · If the error mentions code that is not present in the code you written it probably means you passed some function...
Read more >NodeJS Streams and E2E streaming from Postgres using pg ...
In this demo, we'll use NodeJS and pg-query-stream to implement end-to-end streaming from Postgres to the HTTP client.
Read more >Stream every row coming from a Postgres function
On the client i am trying to use a QueryStream from the pg-query-stream package: pool.connect((err, client, done) => { if (err) throw err...
Read more >[Solved]-TypeError: dest.on is not a function-node.js
... dest.on is not a function-node.js. Search. score:1. Accepted answer. Yeah I asked this question on Node.js help https://github.com/nodejs/help/issues/ ...
Read more >Dest.On Is Not A Function In Gulp Tasks - ADocLib
Many webbased projects feature frontend JavaScript files that are This would serve minified files to our client but it would not solve the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can’t pipe a stream to
console.log
- you’ll want to pipe toprocess.stdout
orprocess.stderr
-console.log
is not a writable stream.If it makes you feel better I’ve piped things to
console.log
many a time & got this error. 🤦♂That one caught me good as it’s both wrong in the documentation and TS typings.
Only to then find out
pg-query-stream
is outdated and doesn’t work anyway: