Looking at the code that is crashing [1], it looks like a header has a non-string value (it's trying to call String's "replace" method on a header value). Arguably, this is a bug in the Node code (it's implicitly converting the value to a string on the previous and following lines, but not on the line that's crashing). Additionally, the non-string value, when converted to a string, has newlines in it.
If you're setting any custom headers, check to see if they're strings or something else (an Error object is a very likely culprit that would get automatically converted to a string with newlines in it). If you can reproduce this in a simple case, maybe also file a bug with Node, since, from glancing through the code, it seems that Node will accept non-string header values and happily convert them to strings, unless the converted string has a newline in it, which is oddly inconsistent. Hope this helps! Jimb [1] https://github.com/joyent/node/blob/master/lib/_http_outgoing.js#L304-L305 On Wednesday, May 27, 2015 at 4:52:16 AM UTC-7, Frederic Brodbeck wrote: > > hi, > > I wrote a program that – usually after several hours – crashes with this > error: > > ``` > TypeError: undefined is not a function > at storeHeader (_http_outgoing.js:303:19) > at ClientRequest.OutgoingMessage._storeHeader (_http_outgoing.js:229:9) > at ClientRequest._implicitHeader (_http_client.js:187:8) > at ClientRequest.OutgoingMessage.end (_http_outgoing.js:529:10) > at Request.end (/Volumes/Macintosh HD > 2/Projects/projects/xyz/node_modules/request/request.js:1533:12) > at end (/Volumes/Macintosh HD > 2/Projects/projects/xyz/node_modules/request/request.js:734:14) > at Immediate._onImmediate (/Volumes/Macintosh HD > 2/Projects/projects/xyz/node_modules/request/request.js:748:7) > at processImmediate [as _immediateCallback] (timers.js:358:17) > ``` > > it uses the `request` module for making http requests, and it does them > periodically. — I'm not sure if it's a request or a node.js problem though. > > multiple intervals are set, and I assume it happens in one of them, but > the stack trace doesn't tell me which one. is there any way to find out? > > node v0.12.4. > os x 10.10.3 > > thanks in advance > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/e6b08350-774e-40dc-b71b-77e55ae351b2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
