Error: getaddrinfo ENOTFOUND

Good day to all.

I have a problem since 1 week where I get headaches from this error.

Error: getaddrinfo ENOTFOUND

Before this I had no problems at all (Very rarely do I get one back then)

What did I do.

  1. Complete server reboot.
  2. Code cleaned up.
  3. Searched the internet which was of no use to me unfortunately.

What exactly am I doing?
Daily, I check over 2,250 streamer every so many minutes. To check if clips have been made on a channel, because unfortunately there is no PubSub available for this. (Made the system so that it goes quietly and does not abuse the Twitch API.) When a clip is made, I post it to Discord where my users receive their clips in their Discord Channels.

My Code

try {
      var options = {
          method: 'GET',
          url: '',
          params: { broadcaster_id: broadcaster_id, started_at: started_at, ended_at: ended_at, first: "20" },
          headers: {
              authorization: 'Bearer ' + process.env.TWITCH_CLIENT_AUTH,
              'client-id': process.env.TWITCH_CLIENT_ID,
              "Accept": "application/vnd.twitchtv.v5+json"

      const promise = axios.request(options).then((response) => response).catch(e => logger('error', 'twitch.js [getClipData]', e));
      return promise;
  } catch (error) {
      console.log('twitch.clips -> getClips' + error);


Although I don’t think there is anything wrong with my code. But how do I solve this problem?
Or should I request a whitelist for Twitch API? So I have no idea, if anyone has a solution, tips & whatever. Would this help me tremendously.

Greetings on my behalf

This indicates there is a problem on your server with DNS lookup’s

Your server doesn’t know where Twitch is.

Side note: Helix doesn’t need this header. It is irrelevant

Otherwise your code looks correct. Your issue isn’t code it’s DNS (or caching of DNS)

Thank you! This is a clear answer. I will remove the header and look at the DNS settings. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.