Closed hst-Sunday closed 1 month ago
Try the same with logging enabled and post the output.
[Rettiwt-API] [2024-09-25T15:36:50.336Z] [REQUEST] {"resource":"LIST_TWEETS","args":{"id":"1838967462660112854","count":10}}
[Rettiwt-API] [2024-09-25T15:36:50.338Z] [AUTHORIZATION] {"authenticated":true}
[Rettiwt-API] [2024-09-25T15:36:50.338Z] [VALIDATE] {"target":"FETCH_ARGS"}
[Rettiwt-API] [2024-09-25T15:36:50.339Z] [GET] {"target":"HTTPS_AGENT"}
[Rettiwt-API] [2024-09-25T15:36:50.339Z] [GET] {"target":"USER_CREDENTIAL"}
[Rettiwt-API] [2024-09-25T15:36:53.303Z] [DESERIALIZE] {"id":"1838864011321872407"}
[Rettiwt-API] [2024-09-25T15:36:53.303Z] [DESERIALIZE] {"id":"1838817346766684408"}
[Rettiwt-API] [2024-09-25T15:36:53.304Z] [DESERIALIZE] {"id":"1838816531347836957"}
@Rishikant181 This is the output after the logging is enabled
Okay so the tweet on which this error occurs exists and is valid. Can you supply me with the method and arguments you used which threw this error?
const ret = await rettiwt.tweet.list("1838967462660112854", 10);
Got the origin of the issue. The problem is the strategy used to identifying and extracting the tweets from the raw response. I'm testing alternative strategies now.
@Rishikant181 Is the fix on the horizon, or is there a workaround? I am getting the same issue with the search
API.
@tjanczuk I've been a bit busy to couldn't find the time to work on this. As for the issue with the search
API, I think it's because of a different reason than the one in list
API. Can you provide me the query which threw this error? Would help me reproducing the issue on my end.
Thanks! The query looks something like this:
await client.tweet.search({
includeWords: ["(#ClimateChange OR #NetZero OR #ESG OR #ClimateAction OR #CarbonEmissions OR #GreenEnergy OR #ClimateTech OR #CSRD OR #COP28) -is:retweet"],
startDate: new Date(Date.now() - 24 * 60 * 60 * 1000)
}, 20);
The issue is intermittent - I suppose it may depend on the actual result of the search request. But the error is the same:
TypeError: Cannot read properties of undefined (reading 'created_at')
at new Tweet (/Users/.../node_modules/rettiwt-api/src/models/data/Tweet.ts:76:33)
On a separate note, it would be nice to be able to pass the Twitter query string directly to the search
API, without having to restate it as TwitterFilter. The use of includeWords
with a single-member array works for that purpose but feels more like a workaround.
I suppose it may depend on the actual result of the search request
Yup, you're right on that. What I'm currently doing is that I'm filtering all items which have their __typename
field set to Tweet
. But sometimes, there maybe nested threads which might throw out an error. Anyways, I'm the exact erroneous item.
it would be nice to be able to pass the Twitter query string directly to the
search
API
I've been trying to provide alternate ways to interact with the API in a more raw form or perhaps a form similar to that of official API. In that direction, I've already made it such that you can get raw response data instead of processed data by using the FetcherService
class. However, as for search query, there is no such mean as of now, but rest assured, I'll try to implement it. The reason TweetFilter
exists is because it encapsulates some validations which are help in the sense that any invalid args are taken care of before the request is actually made to Twitter, thereby saving a single wasted HTTP request.
Great! To get raw responses, do I call FetcherService.request<T>
directly?
@tjanczuk Here is the documentation with an example to help you get started.
Hi, I got into this same problem with the search
method. Looks like sometimes the Tweet
class (rettiwt-api\models\data\Tweet) is instantiated with a object with __typename = '"TweetWithVisibilityResults"'
that insde has a tweet
property with the actual tweet:
@matgott Yes I noticed that too. I'm working on it rn.
Issue has been fixed. Please upgrade rettiwt-api
to v4.1.2
.
There was a "Maximum call stack exceeded" error while deserializing tweet(s) in v4.1.2
.
Please upgrade to v4.1.3
instead.
The program was working fine yesterday, but today this error keeps showing up.