SpiderStrategies / node-tweet-stream

Node twitter module to hook into the public filter streaming, seamlessly updating the tracking keywords.
210 stars 43 forks source link

TypeError: Cannot call method 'abort' of null #36

Closed stevefister closed 8 years ago

stevefister commented 8 years ago

Any ideas?? Thanks!

/mnt/sda1/node-tweet-stream/node_modules/node-tweet-stream/lib/twitter.js:270 this.stream.abort() ^ TypeError: Cannot call method 'abort' of null at Twitter.abort (/mnt/sda1/node-tweet-stream/node_modules/node-tweet-stream/lib/twitter.js:270:15) at null. (/mnt/sda1/node-tweet-stream/node_modules/node-tweet-stream/lib/twitter.js:257:10) at Request.EventEmitter.emit (events.js:95:17) at IncomingMessage. (/mnt/sda1/node-tweet-stream/node_modules/node-tweet-stream/node_modules/request/request.js:965:12) at IncomingMessage.EventEmitter.emit (events.js:95:17) at readableAddChunk (_stream_readable.js:132:14) at IncomingMessage.Readable.push (_stream_readable.js:113:10) at HTTPParser.parserOnBody as onBody at CleartextStream.socketOnData as ondata at CleartextStream.read as _read

nathanbowser commented 8 years ago

Looks like a bug. PR welcome.

stevefister commented 8 years ago

I tried replacing abort() method with destroy(). That stops the error, but then nothing is received. I'm not much of a help as I'm very new to node 😐

jeveloper commented 8 years ago

I believe the steps to recreate this:

  1. track a few items, especially if they are coming in at a high rate
  2. call tw.untrackAll();
  3. track another keyword , BOOM this happens.

Using github master for my code, same thing happens

node-tweet-stream/lib/twitter.js:287 this.stream.abort()

@nathanbowser not entirely sure if there are best practices clearing filters while something is coming in. Any ideas as to why this is happening? Thank you for good work.

nathanbowser commented 8 years ago

Yea, I figured it out. Fix coming shortly.

nathanbowser commented 8 years ago

I had trouble getting a test to reproduce this, but I think it's because you're hitting a twitter rate limit, which aborts the stream in the response callback.

+ node-tweet-stream@1.9.1
jeveloper commented 8 years ago

Hey Nathan, thanks for fixing this :) I think its a great library. Im having a lot of trouble with this bug, so ill be sure to test.

nathanbowser commented 8 years ago

@jeveloper awesome, please let me know!

nathanbowser commented 8 years ago

@jeveloper Did you ever get a chance to try out my fix?

jeveloper commented 8 years ago

Yes it does work :)