react-static-tweets
react-static-tweets copied to clipboard
`fetchTweetAst` returns null
fetchTweetAst
returns null
intermittently.
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"
@sanjay-io Is there an open issue on vercel/fetch
for this? We can take a look.
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:
https://github.com/vercel/fetch/issues/69
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.
+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)
This should now be fixed in v1.0.0
.