Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
309 stars 31 forks source link

bug in Model User.ts #358

Closed vibes2000 closed 10 months ago

vibes2000 commented 10 months ago

when retrieving the user details for an account without pinned tweets the api crashes. see src/models/User.ts this.pinnedTweet = user.legacy.pinned_tweet_ids_str[0];

a null check is required.

Rishikant181 commented 10 months ago

I tried to reproduce the issue by fetching the details of an account without pinned tweets. Can you provide me account which throws the error, so that I can reproduce the error?

vibes2000 commented 10 months ago

Sure. The account that gives an error is @News_Of_Alpha and it happens when fetching the details of the twitter account via the UserService.

TypeError: Cannot read properties of undefined (reading '0') at new User (C:\some-project\src\models\User.ts:70:34) at new CursoredData (C:\some-project\src\models\CursoredData.ts:57:20) at UserService.FetcherService.extractData (C:\some-project\src\services\FetcherService.ts:152:10) at UserService. (C:\some-project\src\services\FetcherService.ts:174:21) at step (C:\some-project\rettiwt-api\services\FetcherService.js:33:23) at Object.next (C:\some-project\rettiwt-api\services\FetcherService.js:14:53) at fulfilled (C:\some-project\rettiwt-api\services\FetcherService.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:95:5)

Rishikant181 commented 10 months ago

The issue has been identified; patch will be released next week by Tuesday earliest.

Rishikant181 commented 10 months ago

@vibes2000 The issue has been fixed in the latest patch release v2.0.3. Please update to the latest version. Let me know if you face further issues.