Amanda gives health tips

My project Bibliogram, a front-end for Instagram (view online), has been randomly crashing on me for quite a while now.

events.js:187
    throw er; // Unhandled 'error' event
    ^

Error: connect ETIMEDOUT 157.240.8.52:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)
Emitted 'error' event on ClientRequest instance at:
    at TLSSocket.socketErrorListener (_http_client.js:406:9)
    at ELSSocket.emit (events.js:210:5)
    ...
{
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '157.240.8.52',
  port: 443
}

This isn't a particularly useful message: I can tell that some request times out while trying to connect to a Facebook-owned IP, but I can't tell what the request was for or what caused it. And I have never reproduced this locally, yet it happens on the server every couple of days.

I'm using node-fetch to send requests out. I figured this should handle timeout errors for me. I guess not? But I'm not sure where to attach an event listener to stop this problem. So the only thing I could think of to do is to try using got to send requests out instead. I built short wrapper classes for both backends so I could have a compatible API, and then I migrated my code to this new API and added a configuration option of which request backend to use (defaulting to node-fetch). I suppose I'll have to wait a few days to see if this actually helps, but I'm trying to be hopeful — I don't know what else to do apart from listening for errors on the entire process and marking this specific error as "don't crash please".

The picture of the day is of the avatar of my Discord bot Amanda, giving tips on how to stay safe during the worldwide COVID-19 outbreak. Though please note that wearing a face mask is not on the list of advice.

One of my flatmate's friends is staying over tonight, who uses no pronouns, only a name. It is extremely difficult to speak around — I barely managed to avoid writing a pronoun twice in that last sentence. Nothing much else to say, I just thought that was interesting. I wonder what it's like to live without pronouns on a day to day basis.

See you next time!

— Cadence

← Previous: To promise or not to promiseNext: Tableau test trickery →