Skip to content

bad proxy exits node without any error #739

@ghost

Description

I've been using node-fetch with different proxies and https-proxy-agent for years. Never had a problem. I switched to another proxy service and every 50 requests or so, the node.js process exits without warning. I know it's the proxy because if I switch to a different proxy it works perfectly.

How can I debug this issue if it just exits without warning and I don't have access to the logs of the proxy service?

This is the code I'm using for testing:

    let counter = 1
    while (true) {
      const agent = new HttpsProxyAgent(proxyUri)
      try {
        const html = await fetch(
          `https://www.google.com`,
          {headers: {'User-Agent': userAgent}, agent, timeout: 5000}
        ).then(res => res.text())
      }
      catch (e) {
        console.log(e.message)
      }
      console.log(counter++)
    }

It always exits without warning between 30-50 iterations with that proxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions