Hey! I help manage a Twitch channel and I'm running into something odd with urlfetch that I can't figure out, so I'd love a second opinion.
Every now and then a command that calls our server just replies "Error Connecting To Remote Server", about 10 seconds after someone types it. The same command works fine a few seconds before and after. It used to be rare, but lately it's happening more: on Oct 26 I counted 11 of them between 18:17 and 20:38 UTC.
Quick idea of our setup: chat commands like !tempo use $(urlfetch https://<our-worker>.workers.dev/?action=read_x&cache_buster=$(time UTC "x")). It's a small Cloudflare Worker on the free plan that returns a short plain text answer (HTTP 200, well under 400 chars, no redirects). It doesn't call Twitch while answering, just reads cached data, and it usually responds in 60-500 ms. I've tried to make it as lightweight as possible.
What's confusing me is that when I check Cloudflare's logs for those errors, there's no request from Nightbot at all. Not a failed one, just nothing (I checked two different log sources for a couple of them). So it looks like the connection dies before a request even gets to us, and I can't see that part.
I also noticed that sometimes a request that does work shows up late. The cache_buster timestamp lets me compare when the command ran with when it reached Cloudflare. Usually it's under a second, but a few times it was +2.5 s, +2.7 s and once +8.6 s, while our server answered in under half a second. That last one was close to a 10 s cutoff, so a slightly worse delay would've been this exact error.
Does anyone know if the 10s is a connect timeout or a total one? And has anything changed on the fetcher side recently?