Skip to content

Setting a keep-alive agent in v3.x.x warns about a possible event emitter leakΒ #1349

Open
@Deivu

Description

Reproduction

Steps to reproduce the behavior:

  1. Make a request with a keep alive agent

Expected behavior

https://github.com/node-fetch/node-fetch#custom-agent

Your Environment

software version
node-fetch 3.0.0
node 16.8.0
npm 7.20.5
Operating System Windows

Additional context

This never happened on fetch v2.x.x and I'm using the same code I use before, as the docs stated that the ESM change is the only breaking change on v3.x.x . I included the stack below

(node:4624) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
WARN [Sat,10/23/21,03:55:41] (Child Process 4624): MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:469:17)
    at TLSSocket.prependListener (node:events:505:14)
    at ClientRequest.<anonymous> (file:///D:/Dev%20Works/Kashima/node_modules/node-fetch/src/index.js:310:10)
    at ClientRequest.emit (node:events:394:28)
    at tickOnSocket (node:_http_client:755:7)
    at onSocketNT (node:_http_client:815:5)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions