Skip to content

Commit 38044c8

Browse files
authored
fix(plugin-network-instrumentation): omit stacktrace from HTTP Error events (#2684)
* fix(plugin-network-instrumentation): omit stacktrace from HTTP Error events * docs: add changelog entry
1 parent 5ebdf17 commit 38044c8

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,42 @@
44

55
### Changed
66

7-
(plugin-network-instrumentation) Manually parse URLs to improve React Native compatibility [#2674](https://github.com/bugsnag/bugsnag-js/pull/2674)
8-
Update bugsnag-android to [v6.22.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.22.0) [#2656](https://github.com/bugsnag/bugsnag-js/pull/2656)
9-
Update bugsnag-cocoa to [v6.35.0](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/v6.35.0) [#2663](https://github.com/bugsnag/bugsnag-js/pull/2663)
7+
- (plugin-network-instrumentation) Manually parse URLs to improve React Native compatibility [#2674](https://github.com/bugsnag/bugsnag-js/pull/2674)
8+
- Update bugsnag-android to [v6.22.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.22.0) [#2656](https://github.com/bugsnag/bugsnag-js/pull/2656)
9+
- Update bugsnag-cocoa to [v6.35.0](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/v6.35.0) [#2663](https://github.com/bugsnag/bugsnag-js/pull/2663)
1010

1111
### Fixed
1212

13-
(plugin-network-instrumentation) Report HTTP Errors as handled [#2662](https://github.com/bugsnag/bugsnag-js/pull/2662)
14-
13+
- (plugin-network-instrumentation) Report HTTP Errors as handled [#2662](https://github.com/bugsnag/bugsnag-js/pull/2662)
14+
- (plugin-network-instrumentation) Omit stacktraces from HTTP Error events [#2684](https://github.com/bugsnag/bugsnag-js/pull/2684)
15+
1516
### Dependencies
1617

17-
Update bugsnag-android to [v6.23.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.23.0) [#2673](https://github.com/bugsnag/bugsnag-js/pull/2673)
18+
- Update bugsnag-android to [v6.23.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.23.0) [#2673](https://github.com/bugsnag/bugsnag-js/pull/2673)
1819

1920
## [8.8.1] - 2026-01-26
2021

2122
### Fixed
2223

23-
(plugin-network-breadcrumbs, plugin-network-instrumentation) Ensure XMLHttpRequest response types are handled gracefully [#2660](https://github.com/bugsnag/bugsnag-js/pull/2660)
24+
- (plugin-network-breadcrumbs, plugin-network-instrumentation) Ensure XMLHttpRequest response types are handled gracefully [#2660](https://github.com/bugsnag/bugsnag-js/pull/2660)
2425

2526
## [8.8.0] - 2026-01-20
2627

2728
This release adds support for notitfying failed network requests using the new `plugin-network-instrumentation` package
2829
### Added
2930

30-
(plugin-network-instrumentation) Add new plugin to notify failed network requests [#2647](https://github.com/bugsnag/bugsnag-js/pull/2647)
31-
(plugin-cloudflare-workers): Add initial support for Cloudflare Workers [#2643](https://github.com/bugsnag/bugsnag-js/pull/2643) [#2644](https://github.com/bugsnag/bugsnag-js/pull/2644)
32-
(plugin-contextualize) Return callback value from contextualize plugin [#2654](https://github.com/bugsnag/bugsnag-js/pull/2654)
31+
- (plugin-network-instrumentation) Add new plugin to notify failed network requests [#2647](https://github.com/bugsnag/bugsnag-js/pull/2647)
32+
- (plugin-cloudflare-workers): Add initial support for Cloudflare Workers [#2643](https://github.com/bugsnag/bugsnag-js/pull/2643) [#2644](https://github.com/bugsnag/bugsnag-js/pull/2644)
33+
- (plugin-contextualize) Return callback value from contextualize plugin [#2654](https://github.com/bugsnag/bugsnag-js/pull/2654)
3334

3435
### Fixed
3536

36-
(plugin-server-session) Delay session tracker initialization until first use [#2642](https://github.com/bugsnag/bugsnag-js/pull/2642)
37+
- (plugin-server-session) Delay session tracker initialization until first use [#2642](https://github.com/bugsnag/bugsnag-js/pull/2642)
3738

3839
### Dependencies
3940

40-
Update bugsnag-cocoa to [6.34.1](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/6.34.1) [#2606](https://github.com/bugsnag/bugsnag-js/pull/2606)
41-
Update bugsnag-android to [v6.20.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.20.0) [#2625](https://github.com/bugsnag/bugsnag-js/pull/2625)
41+
- Update bugsnag-cocoa to [6.34.1](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/6.34.1) [#2606](https://github.com/bugsnag/bugsnag-js/pull/2606)
42+
- Update bugsnag-android to [v6.20.0](https//github.com/bugsnag/bugsnag-android/releases/tag/v6.20.0) [#2625](https://github.com/bugsnag/bugsnag-js/pull/2625)
4243

4344
## [8.7.0] - 2025-10-13
4445

packages/plugin-network-instrumentation/network-instrumentation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ module.exports = (config = {}, global = window) => {
148148
0
149149
)
150150

151+
event.errors[0].stacktrace = [] // Omit the stacktrace for HTTP errors
151152
event.request = requestObj
152153
event.response = responseObj
153154
event.context = `${method} ${domain}`

packages/plugin-network-instrumentation/test/network-instrumentation-xhr.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ describe('plugin-network-instrumentation', () => {
133133
// Verify error details
134134
expect(event.exceptions[0].errorClass).toBe('HTTPError')
135135
expect(event.exceptions[0].errorMessage).toBe('404: https://api.example.com/users/123')
136+
expect(event.exceptions[0].stacktrace).toEqual([]) // Stacktrace should be empty for HTTP errors
136137
expect(event.context).toBe('POST api.example.com')
137138
expect(event.severity).toBe('error')
138139
expect(event.unhandled).toBe(false)

packages/plugin-network-instrumentation/test/network-instrumentation.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ describe('plugin-network-instrumentation', () => {
8585

8686
expect(event.exceptions[0].errorClass).toBe('HTTPError')
8787
expect(event.exceptions[0].errorMessage).toBe('404: https://example.com/api/users')
88+
expect(event.exceptions[0].stacktrace).toEqual([]) // Stacktrace should be empty for HTTP errors
8889
expect(event.context).toBe('GET example.com')
8990
expect(event.severity).toBe('error')
9091
expect(event.unhandled).toBe(false)

test/browser/features/http_errors.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Feature: HTTP Errors
1515

1616
And the exception "errorClass" equals "HTTPError"
1717
And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
18+
And the error payload field "events.0.exceptions.0.stacktrace" is an array with 0 elements
1819
And the event "severity" equals "error"
1920
And the event "unhandled" is false
2021
And the event "severityReason.type" equals "httpError"
@@ -45,6 +46,7 @@ Feature: HTTP Errors
4546

4647
And the exception "errorClass" equals "HTTPError"
4748
And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
49+
And the error payload field "events.0.exceptions.0.stacktrace" is an array with 0 elements
4850
And the event "severity" equals "error"
4951
And the event "unhandled" is false
5052
And the event "severityReason.type" equals "httpError"
@@ -77,6 +79,7 @@ Feature: HTTP Errors
7779

7880
And the exception "errorClass" equals "HTTPError"
7981
And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
82+
And the error payload field "events.0.exceptions.0.stacktrace" is an array with 0 elements
8083
And the event "severity" equals "error"
8184
And the event "unhandled" is false
8285
And the event "severityReason.type" equals "httpError"
@@ -108,6 +111,7 @@ Feature: HTTP Errors
108111

109112
And the exception "errorClass" equals "HTTPError"
110113
And the error payload field "events.0.exceptions.0.message" equals the stored value "expected.exception.message"
114+
And the error payload field "events.0.exceptions.0.stacktrace" is an array with 0 elements
111115
And the event "severity" equals "error"
112116
And the event "unhandled" is false
113117
And the event "severityReason.type" equals "httpError"

0 commit comments

Comments
 (0)