ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

I am getting an error on runtime #452

Closed amandeepmittal closed 6 years ago

amandeepmittal commented 6 years ago
events.js:183
2018-07-04T07:02:44.513154+00:00 app[worker.1]:       throw er; // Unhandled 'error' event
2018-07-04T07:02:44.513157+00:00 app[worker.1]:       ^
2018-07-04T07:02:44.513158+00:00 app[worker.1]: 
2018-07-04T07:02:44.513160+00:00 app[worker.1]: Error: Bad Twitter streaming request: 401
2018-07-04T07:02:44.513163+00:00 app[worker.1]:     at Object.exports.makeTwitError (/app/node_modules/twit/lib/helpers.js:74:13)
2018-07-04T07:02:44.513165+00:00 app[worker.1]:     at Request.<anonymous> (/app/node_modules/twit/lib/streaming-api-connection.js:96:29)
2018-07-04T07:02:44.513166+00:00 app[worker.1]:     at emitOne (events.js:121:20)
2018-07-04T07:02:44.513168+00:00 app[worker.1]:     at Request.emit (events.js:211:7)
2018-07-04T07:02:44.513171+00:00 app[worker.1]:     at IncomingMessage.<anonymous> (/app/node_modules/twit/node_modules/request/request.js:1079:12)
2018-07-04T07:02:44.513172+00:00 app[worker.1]:     at Object.onceWrapper (events.js:313:30)
2018-07-04T07:02:44.513174+00:00 app[worker.1]:     at emitNone (events.js:111:20)
2018-07-04T07:02:44.513175+00:00 app[worker.1]:     at IncomingMessage.emit (events.js:208:7)
2018-07-04T07:02:44.513178+00:00 app[worker.1]:     at endReadableNT (_stream_readable.js:1064:12)
2018-07-04T07:02:44.513181+00:00 app[worker.1]:     at _combinedTickCallback (internal/process/next_tick.js:138:11)
2018-07-04T07:02:44.513182+00:00 app[worker.1]:     at process._tickCallback (internal/process/next_tick.js:180:9)
maziyarpanahi commented 6 years ago

Hi @amandeepmittal,

It would be really helpful to have look at your code. The stream and what you are tracking.

hannahmiller515 commented 6 years ago

I was having this exact same error simply trying to use the 'statuses/sample' endpoint. However, I was also using a Twitter configuration that had app_only_auth set to true. After removing this setting I no longer get the error. Maybe make sure you aren't using app only authentication.

amandeepmittal commented 6 years ago

I am closing this issue as the problem I have found was with the tokens.

danielriddell21 commented 6 years ago

@amandeepmittal Im having a similar issue. What was wrong with your tokens?

amandeepmittal commented 6 years ago

Generate new tokens from Twitter app section. It will be solved.