Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

fetchTweetAst returns null #43

Closed
kush-mish opened this issue Apr 26, 2022 · 6 comments · Fixed by #45
Closed

fetchTweetAst returns null #43

kush-mish opened this issue Apr 26, 2022 · 6 comments · Fixed by #45

Comments

@kush-mish
Copy link

fetchTweetAst returns null intermittently.

@kush-mish kush-mish changed the title fetchTweetAst return null fetchTweetAst returns null Apr 26, 2022
@sanjay-io
Copy link

There's a bug in vercel's implementation of fetch which static-tweets is leveraging on subsequent calls vercel's fetch is returning null.

If you add this postinstall script to your package.json, should temp fix the issue and use default implementation of fetch.

"postinstall": "perl -pi -e 's/var fetch.*//g' node_modules/static-tweets/build/index.js"

@leerob
Copy link

leerob commented Jun 5, 2022

@sanjay-io Is there an open issue on vercel/fetch for this? We can take a look.

@sanjay-io
Copy link

hey @leerob, I didn't find an open issue that was indicative of this problem, my mistake for not creating one. I created one over here with much more information:

vercel/fetch#69

@transitive-bullshit
Copy link
Owner

transitive-bullshit commented Jun 10, 2022

After some investigation, the same behavior occurs using node-fetch, got, and even the underlying node:https module directly.

The first GET is always successful, and subsequent GET requests 404. If you override the https agent to disable TLS session caching, then everything works fine. This is probably symptomatic of a weird TLS bug on Twitter's side, or it may be intentional on Twitter's behalf since the approach this library uses is kind of piggy-backing on Twitter's syndication API in a way that it wasn't intended to be used.

In any case, the fix will be to disable TLS caching when making calls to Twitter's syndication API. I'll include this fix in an update shortly.

@jellohouse
Copy link

+1 getting the same problem.
As a matter of fact for me const ast = await fetchTweetAst(tweetId); returns null all the time (not only intermittently)

@transitive-bullshit
Copy link
Owner

This should now be fixed in v1.0.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants