256cats / check-proxy

Advanced Node proxy checker (node proxy verifier, node proxy tester) with socks and https support
https://www.npmjs.com/package/check-proxy
MIT License
107 stars 40 forks source link

Not working with node-fetch #15

Open lbovolini opened 2 weeks ago

lbovolini commented 2 weeks ago
import fetch from "node-fetch"
import cp from "check-proxy"
const { check } = cp
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object
    at checkListener (node:events:277:3)
    at ClientRequest.once (node:events:654:3)
    at new ClientRequest (node:_http_client:244:10)
    at Object.request (node:https:379:10)
    at Object.<anonymous> (/home/lucasb/Dev/preco-supremo/preco-supremo-scraper-store-js/app/node_modules/proxy-agent/node_modules/agent-base/patch-core.js:23:20)
    at Object.<anonymous> (/home/lucasb/Dev/preco-supremo/preco-supremo-scraper-store-js/app/node_modules/agent-base/patch-core.js:25:22)
    at /home/lucasb/Dev/preco-supremo/preco-supremo-scraper-store-js/app/node_modules/pac-proxy-agent/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js:23:20
    at file:///home/lucasb/Dev/preco-supremo/preco-supremo-scraper-store-js/app/node_modules/node-fetch/src/index.js:94:20
    at new Promise (<anonymous>)
    at fetch (file:///home/lucasb/Dev/preco-supremo/preco-supremo-scraper-store-js/app/node_modules/node-fetch/src/index.js:49:9) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Works if i remove check-proxy import

lbovolini commented 2 weeks ago

None new http client library seems to work, must be a issue related to outdated dependencies. I updated the dependencies with ncu -u command. Fixes the error, but library seens to does not work.