fix(core): Return same value from startSpan as callback returns#19300
fix(core): Return same value from startSpan as callback returns#19300
startSpan as callback returns#19300Conversation
Codecov Results 📊Generated by Codecov Action |
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
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.
| }, | ||
| ); | ||
|
|
||
| return value; |
There was a problem hiding this comment.
Side-effect handlers suppress unhandled promise rejection detection
Medium Severity
Calling value.then(_, onRejected) on the original promise before returning it marks the rejection as "handled" in the JS engine. If the caller of startSpan doesn't handle the rejected promise, no unhandledrejection event fires, silently swallowing the error. Previously, errors would propagate through the .then() chain and surface as unhandled rejections. The onError callback only sets span status — the actual exception is never captured via captureException for plain startSpan usage.
Additional Locations (1)
|
Converting to a draft, going to push some more commits to try out a slightly different approach to this. The Remix failures are interesting. Playwright timing out is less interesting, but also could be indicative of a problem, if it's waiting for an expected failure that we're swallowing (haven't dug deeply into it yet). |
This might be an acceptable compromise, so long as it doesn't blow up our bundle size too much. Copy properties from the original promise onto the chained tracker, so that we can return something that can inspect the error, does not obscure `unhandledrejection`, *and* supports jQuery's extended PromiseLike objects.


When using
startSpan,.then()is called on the callback's return value. This creates another Promise which is a problem in for example jQuery, where the returned Promise does not have the same methods as the jqXHR object.Closes #19242