node
node copied to clipboard
Debuggers cannot set breakpoints in certain Node.js internals
Version
21.4.0
Platform
Darwin mbp.peet.io 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64
Subsystem
inspector
What steps will reproduce the bug?
- Have a script containing
setTimeout(() => {}, 0); setTimeout(() => {}, 0)
- Debug the script in your choice of debugger.
- Step into
setTimeout
and set a breakpoint in `timers. Continue.
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
The breakpoint should bind and the debugger should pause in the next call to setTimeout()
What do you see instead?
The debugger doesn't pause and the process exits
Additional information
- Chrome devtools will set the breakpoint via
Debugger.setBreakpointByUrl
, but setting the breakpoint by the script ID (Debugger.setBreakpoint
) oftimers
also does not work, returning error -32000 "Could not resolve breakpoint" - This regressed between Node 14 and Node 16
- This appears to only affect scripts loaded into executionContextId: 0. Breakpoints in other scripts, such code in
crypto
, work without issue. - Potentially related to https://github.com/nodejs/node/issues/47438