Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Using cloudflare 2.7.0 with got 11.5.0 breaks got's DNS resolver globally #76

Closed
tobiasmuehl opened this issue Jul 12, 2020 · 1 comment

Comments

@tobiasmuehl
Copy link

tobiasmuehl commented Jul 12, 2020

This bug just happened today and is one of those that make me give up my faith in humanity and computers. Just posting this here in case someone else has this problem.

This file will work just fine:

import got from 'got'

;(async() => {
  console.dir(await got('https://icanhazip.com'))
})()

This won't:

import got from 'got'
import * as cloudflare from 'cloudflare'

;(async() => {
  console.dir(await got('https://icanhazip.com'))
})()
(node:17224) UnhandledPromiseRejectionWarning: RequestError: connect ECONNREFUSED 127.0.0.1:443
    at ClientRequest.<anonymous> (node_modules/got/dist/source/core/index.js:889:25)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.EventEmitter.emit (domain.js:485:12)
    at ClientRequest.origin.emit (node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at TLSSocket.socketErrorListener (_http_client.js:432:9)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket.EventEmitter.emit (domain.js:485:12)
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

Note that I'm not even using the imported package, the import itself is sufficient to break all usages of got in the whole file.

The fix was to bump the version of cloudflare to 2.8.0 in the package.json. SMH.

@terinjokes
Copy link
Contributor

Thanks for the report.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants