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.
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:
This won't:
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.