-
Notifications
You must be signed in to change notification settings - Fork 106
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
nowritecb error thrown #1
Comments
it's possible this is due to not having a more consistent streams2 stack; one of the reasons I wrote this and also csv2 is because mixing and matching streams2 with other style streams can be a bit hit-and-miss. Can you show me more of your code? What's piping in to your through2 stream? Also, your transformFrunction can't be bound to anything else, it must be passed in as a plain function that can participate as a member of the stream.Transform class. |
Ya, I made sure the functions weren't bound to anything. It might by a mixture somewhere of the streams2 and streams somewhere in the pipe. Would that cause it? JSONStream does start it all off at the beginning of the pipes. |
JSONStream is based on through which I've had some streams2 compat issues with, but it seems to work ok with through2 with basic use: var hyperquest = require('hyperquest')
, JSONStream = require('JSONStream')
, through2 = require('through2')
hyperquest('http://isaacs.couchone.com/registry/_all_docs')
.pipe(JSONStream.parse('rows.*'))
.pipe(through2({ objectMode: true }, function (chunk, enc, callback) {
this.push({ name: chunk.key })
callback()
}))
.on('data', console.log) ->
What else do you have in your stream stack? And is this error happening before you get any output, in the middle somewhere or at the end of a stream? |
would an error be called if using the callback with callback(null, cunk); |
I don't think it would cause an error. You can see the implementation of that callback here: https://github.com/joyent/node/blob/9e1eb361e8deb3f296a3c9d01de8fcc10361443f/lib/_stream_transform.js#L73-L106 - note there's a |
.pipe(through2({ objectMode: true }, function (chunk, enc, callback) {
callback(null, { name: chunk.key })
})) does the same thing as the example above. There's no chance your |
It looks like the way you get that error is by calling the callback twice, e.g.: var spigot = require("stream-spigot")
var through = require("through2")
var tx = through(function (chunk, encoding, callback) {
callback(null)
callback(null, chunk)
})
spigot(["a", "b", "c", "d"])
.pipe(tx)
.pipe(process.stdout)
|
@brycebaril I think it might not be about calling the callback twice as much as it is about calling the callback with a null value. But yo calling it twice produces the error as well. Thanks for the heads up. Sent me in the right direction. |
After updating to 0.0.5 and using the default streams class, I'm still getting the error. I'm going to assume it's my code and close the issue. I'll re open if I find otherwise. Thanks for all the insight. |
Very interesting, but also very weird! Glad you fixed it though. |
The clue came from the discussion here: rvagg/through2#1
I had this error today and the reason is I called the |
Thanks @towry 👍 |
Any reason why I would be getting the following error:
Code worked using
map-stream
module. Converterted to try this module and getting this error now.Thanks.
The text was updated successfully, but these errors were encountered: