-
-
Notifications
You must be signed in to change notification settings - Fork 669
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
When launching debug mode, all events are written to logs 2-3 times.
Moreover, if you subscribe to the channel yourself, you will receive one event.
I understood that this is due to the fact that we subscribe to the event twice if we use undici, this is in undici inside the node and in undici as a dependency.
Reproducible By
NODE_DEBUG=undici node ./debug.js
import { request, Agent } from 'undici';
const dispatcher = new Agent({ connections: 1 });
async function execute() {
const resp = await request('https://cdn.datatables.net/2.3.4/js/dataTables.min.js', { dispatcher });
await resp.body.dump();
}
execute();
async function undici() {
const { fetch} = await import('undici');
const resp = await fetch('https://cdn.datatables.net/2.3.4/js/dataTables.min.js');
await resp.arrayBuffer();
}
async function nodeUndici(){
const resp = await fetch('https://cdn.datatables.net/2.3.4/js/dataTables.min.js');
await resp.arrayBuffer();
}
// one debug logs
nodeUndici();
// duplicated debug logs
// undici();
Expected Behavior
Logs for a single query should not be duplicated.
Logs & Screenshots

Environment
node - v24.9.0 and v22.19.0
undici - 7.16.0
Additional context
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working