1

Does anybody know how to handle the error from below properly? Obviously, I am using a 3rd party library that performs an internal HTTP poll to a remote API, sometimes, it throws a connection refusal error and crashes the whole NodeJS process.

    return new Promise((resolve, reject) => {
            page.getRecaptchaSolutions(captchas).then(({ solutions, solErrors }) => {
                if (solErrors)
                    reject(solErrors);

                resolve(solutions)
            })
            .catch(error => {
                reject(new Error(error))
            })  
    })
Error: getaddrinfo EAI_AGAIN 2captcha.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)
Emitted 'error' event on ClientRequest instance at:
    at Socket.socketErrorListener (_http_client.js:406:9)
    at Socket.emit (events.js:223:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:81:21) {
  errno: 'EAI_AGAIN',
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: '2captcha.com'
}

Allan Chua
  • 9,305
  • 9
  • 41
  • 61
  • Does this answer your question? [What's the source of Error: getaddrinfo EAI\_AGAIN?](https://stackoverflow.com/questions/40182121/whats-the-source-of-error-getaddrinfo-eai-again) – maio290 Mar 14 '20 at 01:59

0 Answers0