observing / fullcontact

FullContact API bindings for Node.js
MIT License
42 stars 18 forks source link

Cannot read property 'headers' of undefined #2

Closed aartiles closed 11 years ago

aartiles commented 11 years ago

Hi, My app crash whenever Fullcontact send responses without headers. Could you check if res.headers exists before accessing res.headers['x-rate-limit-reset']?

Thanks!

"TypeError: Cannot read property 'headers' of undefined",
" at Request.requested (/home/socialb/node_modules/fullcontact/index.js:75:26)",
" at Request.init.self.callback (/home/socialb/node_modules/fullcontact/node_modules/request/index.js:148:22)",
" at Request.EventEmitter.emit (events.js:96:17)",
" at ClientRequest.Request.init.self.clientErrorHandler (/home/socialb/node_modules/fullcontact/node_modules/request/index.js:257:10)",
" at ClientRequest.EventEmitter.emit (events.js:96:17)",
" at CleartextStream.socketCloseListener (http.js:1424:9)",
" at CleartextStream.EventEmitter.emit (events.js:126:20)",
" at SecurePair.destroy (tls.js:956:22)",
" at process.startup.processNextTick.process._tickCallback (node.js:244:9)"
3rd-Eden commented 11 years ago

Is this reproducible in any way?

Sent from my iPhone

On Oct 1, 2013, at 18:24, Alfredo Artiles notifications@github.com wrote:

Hi, My app crash whenever Fullcontact send responses without headers. Could you check if res.headers exists before accessing res.headers['x-rate-limit-reset']?

Thanks!

"TypeError: Cannot read property 'headers' of undefined", " at Request.requested (/home/socialb/node_modules/fullcontact/index.js:75:26)", " at Request.init.self.callback (/home/socialb/node_modules/fullcontact/node_modules/request/index.js:148:22)", " at Request.EventEmitter.emit (events.js:96:17)", " at ClientRequest.Request.init.self.clientErrorHandler (/home/socialb/node_modules/fullcontact/node_modules/request/index.js:257:10)", " at ClientRequest.EventEmitter.emit (events.js:96:17)", " at CleartextStream.socketCloseListener (http.js:1424:9)", " at CleartextStream.EventEmitter.emit (events.js:126:20)", " at SecurePair.destroy (tls.js:956:22)", " at process.startup.processNextTick.process._tickCallback (node.js:244:9)"

— Reply to this email directly or view it on GitHub.

aartiles commented 11 years ago

It's kind of random. Sometimes res.headers comes empty from fullcontact API but I don't know how to reproduce it.

3rd-Eden commented 11 years ago

I'm now checking if there are errors before parsing the headers. So you will most likely receive an error argument in your callbacks now. Still would love to know what causes this, but at least it's not crashing you any more.

Release will be in npm in a couple of minutes.

aartiles commented 11 years ago

Great, I'll keep you posted. Thanks