Intermittent DNS Failure running Discord bot on Droplet

I’m trying to run a discord node js server on a digital ocean droplet and seeing this error around 24 hours after launching the process. I believe it’s crashing my app. Any idea what’s going on and how to handle this?

I see it’s a DNS lookup error, but I can’t figure out what is causing it and how to safely keep the bot alive.

Error: getaddrinfo EAI_AGAIN
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
  errno: 'EAI_AGAIN',
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: '',
  request: ClientRequest {
    shouldKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
"logs.txt" 216L, 7582C                                                                                                                                                 3,5           Top
      [Symbol(connect-options)]: [Object]
      'Host:\r\n' +
      'Authorization: XXXXXX +
      'User-Agent: DiscordBot (, 11.5.1) Node.js/v12.18.1\r\n' +
      'Content-Type: application/json\r\n' +
      'Accept-Encoding: gzip, deflate\r\n' +
      'Connection: keep-alive\r\n' +
      'Content-Length: 26\r\n' +
    _onPendingData: [Function: noopPendingOutput],
    path: '/api/v7/channels/796972614174113792/messages',

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @innovatingbliss,

getaddrinfo is by definition a DNS issue. Does dig host or nslookup host work?

Additionally, what DNS are you using, is it DigitalOcean’s one, if not, can you confirm from where and how are you using your DNS, is it selfhosted, when did you configure the DNS? Please note that DNS propagation can take up to 24 hours to work.

Regards, KFSys