Response data crashes node #8

deanotron opened this Issue Oct 12, 2010 · 1 comment


None yet
1 participant

I haven't been able to get further down the stack from this but it looks like the page responses are not being templated properly

for each response node is failing at!/lib/jsgi-node.js:165:18
forEachResult = data.body.forEach( function( chunk ) {
response.write( chunk, data.body.encoding || "utf8" );

Adding a try/catch around this shows that the problem is that the chunk being passed through is a js object rather than a string. here is the output from each chunk:

chunk 0:

chunk 1:
{ pageName: 'Example'
, content: '<p>asdf asdf asdf</p>'
, location: undefined
{ message: 'first argument must be a string, Array, or Buffer'
, stack: [Getter/Setter]

chunk 2:

TypeError: first argument must be a string, Array, or Buffer
at ServerResponse.write (http:488:11)
at jar:!/lib/jsgi-node.js:165:18
at Object.forEach (eval at (jar:!/lib/template.js:32:12))
at jar:!/lib/media/html.js:66:24
at jar:!/lib/promise.js:320:10
at jar:!/lib/media/html.js:65:13
at notify (jar:!/lib/promise.js:162:22)
at [object Object].then (jar:!/lib/promise.js:215:4)
at jar:!/lib/promise.js:314:20
at Object.forEach (jar:!/lib/media/html.js:64:12)

Adjusting templify to return the template path with '.template' fixes the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment