Skip to content
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

buffer encoding issue #5

Open
jandrieu opened this issue Mar 10, 2015 · 1 comment
Open

buffer encoding issue #5

jandrieu opened this issue Mar 10, 2015 · 1 comment

Comments

@jandrieu
Copy link

With both node v.0.10.13 and v0.12.0 I get the following error when entering anything from the cli:

couchjs/0.3.2 23920: /usr/share/couchdb/server/main.js
Call main
Uncaught error:
TypeError: Unknown encoding: buffer
    at Buffer.toString (buffer.js:274:17)
    at LineStream2._transform (node_modules/couchjs/stream.js:36:21)
    at LineStream2.Transform._read (_stream_transform.js:179:10)
    at LineStream2.Transform._write (_stream_transform.js:167:12)
    at doWrite (_stream_writable.js:301:12)
    at writeOrBuffer (_stream_writable.js:288:5)
    at LineStream2.Writable.write (_stream_writable.js:217:11)
    at ReadStream.ondata (_stream_readable.js:540:20)
    at ReadStream.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)

From what I can tell, although the CLI sets the encoding (on line 70), _stream_writable.js:writeOrBuffer sets the encoding to 'buffer', despite successfully "decoding" the chunk. My current guess is that _stream_writable.js:decodeChunk is /supposed/ to return a string.
...
Later: I actually fixed this particular bug not by changing decodeChunk (that caused other problems), but instead by not overriding the encoding. If it is already set, we don't change it to 'buffer' in writeOrBuffer.

My pull request for node.js with a bug fix is here:
nodejs/node-v0.x-archive#9372

@JKDingwall
Copy link

Installing nodejs 0.10.38 on Ubuntu 14.04 with CouchDB 1.6.1 and couchjs installed from git gives a a similar unknown encoding error in the couchjs.log:

Call main
Uncaught error:
TypeError: Unknown encoding: buffer
    at Buffer.toString (buffer.js:434:13)
    at LineStream2._transform (/usr/lib/node_modules/couchjs/stream.js:36:21)
    at LineStream2.Transform._read (_stream_transform.js:179:10)
    at LineStream2.Transform._write (_stream_transform.js:167:12)
    at doWrite (_stream_writable.js:226:10)
    at writeOrBuffer (_stream_writable.js:216:5)
    at LineStream2.Writable.write (_stream_writable.js:183:11)
    at write (_stream_readable.js:602:24)
    at flow (_stream_readable.js:611:7)
    at Socket.pipeOnReadable (_stream_readable.js:643:5)
couchjs/0.3.2 11391: /zcp/couchdb/share/couchdb/server/main.js

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty
# curl -sL https://deb.nodesource.com/setup | sudo bash - # 0.10
# apt-get -y install nodejs
# npm install -g git://github.com/iriscouch/couchjs.git

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

2 participants