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

tacodb 1.0.11 taco-demo fails with first argument must be string or buffer error. #4

Open
No9 opened this issue Jun 17, 2013 · 1 comment

Comments

@No9
Copy link
Contributor

No9 commented Jun 17, 2013

On linux ubuntu 13.10 and Mac OS 10.7.5

npm install tacodb -g

Checkout and install taco-demo

git clone git://github.com/No9/taco-demo.git
cd taco-demo 
npm install 
./build.sh

Browse to
http://localhost:8000/http/tacodemo/

Server crashes with

GET /http/taco-demo/ 1371464955325

http.js:955
      throw new TypeError('first argument must be a string or Buffer');
            ^
TypeError: first argument must be a string or Buffer
    at ServerResponse.OutgoingMessage.end (http.js:955:13)
    at respond (securify:1301:18)
    at /home/anton/github/lib/node_modules/tacodb/node_modules/level/node_modules/levelup/lib/levelup.js:189:13
@dominictarr
Copy link
Owner

dominictarr: aha, I found the problem
[1:11pm] dominictarr: it's to do with browserify bundles
[1:11pm] dominictarr: the problem is in securify
[1:12pm] dominictarr: the bfy stuff is bundling buffer-browserify
[1:12pm] dominictarr: when we want it to just leave that out and use the core version.
[1:14pm] no9: Ah so the error was in the right place so
[1:16pm] dominictarr: yeah, the problem was it was doing res.end(buffer)
[1:16pm] dominictarr: except node didn't agree that Buffer.isBuffer(buffer)
[1:19pm] dominictarr: how i found the bug: read the node.js http code, then added a monkey patch to log what was really being passed to res.end(….)
[1:24pm] dominictarr: if you want an urgent hack - fix level-static to always write strings
[1:24pm] dominictarr: or
[1:25pm] dominictarr: var end = http.OutgoingMessage.prototype.end; http.OutgoingMessage.prototype.end = function (data) { if (data) data = data.toString(); end.call(this, data) }

will fix soon.

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