Conversation
…attributes On Node 22+ with Next.js 15, the bundled `@mswjs/interceptors` emits a synthetic `response` event on request timeout/abort whose `IncomingMessage` has `httpVersion === null`. `_getOutgoingRequestEndedSpanData` called `httpVersion.toUpperCase()` unguarded, which crashed the process with an unhandled rejection. The sibling server-side code in `httpServerSpansIntegration` already optional-chains this attribute; this brings the client path in line. Fixes #20415 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4d64142. Configure here.
There was a problem hiding this comment.
Pull request overview
Guards Node outgoing HTTP span attribute generation against httpVersion === null to prevent crashes on synthetic response events (e.g., Node 22 + Next.js 15 + bundled @mswjs/interceptors), aligning behavior with the existing server-side HTTP spans integration.
Changes:
- Update outgoing response span attribute construction to optional-chain
httpVersion?.toUpperCase()when computingnet.transport. - Add inline comment referencing prior similar handling and the reported issue.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tion.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
size-limit report 📦
|
nicohrubec
left a comment
There was a problem hiding this comment.
Maybe we should cover this with a small unit test? Other than that lgtm :)
…` null httpVersion guard Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@nicohrubec I forgot to push them, thanks! I added a few more tests now. |

It appears that
httpVersioncan beundefinedin some cases, and even tho the node types don't suggest that we do seem to treat it as such in other parts of the code so I assume we have run into this before.This PR guards against this specific usage here as this is the only place where it wasn't guarded.
Fixes #20415