inspector: response.setEncoding() causes response.on('data') never triggered when --experimental-network-inspection is enabled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Version
v24.17.0
Platform
Windows 11 x64 (10.0.26200)
Subsystem
No response
What steps will reproduce the bug?
When experimental network inspection is enabled, calling response.setEncoding() on an http.IncomingMessage causes Node Inspector to throw exception.
The exception interrupts normal stream processing. response.on("data") callback never triggered.
const http = require('http');
http.get("http://example.com", (response) => {
response.setEncoding("utf8");
response.on("data", chunk => {
console.log(chunk);
});
response.on("end", () => {
console.log("end");
process.exit(0);
});
});
Run node --inspect --experimental-network-inspection main.js then open any inspector frontend (Chrome DevTools).
How often does it reproduce? Is there a required condition?
When network inspection feature enabled.
What is the expected behavior? Why is that the expected behavior?
Network inspection should continue to work regardless of whether response.setEncoding() is used.
What do you see instead?
Nodejs throws exception and interrupts normal stream processing. response.on("data") callback never triggered.
Additional information
VSCode extension debugging host enables this feature and breaks my extension development. Waste 2 days to find out why every http request got empty response.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided HTTP example with node --inspect --experimental-network-inspection main.js and an inspector frontend, then capture the exception triggered by response.setEncoding(). Trace the network inspection handling that interrupts the stream; done means the data and end callbacks run normally with encoding enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100