Skip to content

Commit 5b33e20

Browse files
authored
Merge pull request #2192 from bugsnag/release/v8.0.0
Release v8.0.0
2 parents 5debffd + 00ea043 commit 5b33e20

File tree

294 files changed

+83678
-14361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+83678
-14361
lines changed

.buildkite/basic/node-pipeline.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ steps:
2727
depends_on: "node-maze-runner-image"
2828
timeout_in_minutes: 30
2929
matrix:
30-
- 4
31-
- 6
32-
- 8
33-
- 10
3430
- 12
3531
- 14
32+
- 16
33+
- 18
34+
- 20
3635
plugins:
3736
docker-compose#v4.12.0:
3837
run: node-maze-runner

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## [8.0.0] - 2024-08-29
4+
5+
### Summary
6+
7+
As well as some bug fixes and **breaking changes** described in the [Upgrade Guide](./UPGRADING.md), this major SDK release has the following key features:
8+
9+
- Improved API for NodeJS: the `Bugsnag` client can now be used to call SDK methods in the context of the current request
10+
- Breadcrumb support for NodeJS: we now support manual breadcrumbs and capture console breadcrumbs automatically
11+
- Improved session reporting for single page apps: a session is now created only once per page load to more accurately reflect a user's session in your app
12+
13+
### Added
14+
15+
- (node) Add support for manual breadcrumbs [#1927](https://github.com/bugsnag/bugsnag-js/pull/1927) and automatic console breadcrumbs [#2107](https://github.com/bugsnag/bugsnag-js/pull/2107)
16+
- Support error correlation properties in event payloads [#2174](https://github.com/bugsnag/bugsnag-js/pull/2174)
17+
18+
### Fixed
19+
20+
- (plugin-angular) Prevent excess change detection cycles when calling `Bugsnag.notify` [#1861](https://github.com/bugsnag/bugsnag-js/pull/1861)
21+
22+
### Changed
23+
24+
- (node) Enable breadcrumbs and context-scoped calls [#1927](https://github.com/bugsnag/bugsnag-js/pull/1927)
25+
- (plugin-contextualize) Reimplement without relying on the deprecated node Domain API. From Node 16+ unhandled promise rejections are also supported [#1924](https://github.com/bugsnag/bugsnag-js/pull/1924)
26+
- (plugin-navigation-breadcrumbs) Calling `pushState` or `replaceState` no longer triggers a new session when `autoTrackSessions` is enabled [#1820](https://github.com/bugsnag/bugsnag-js/pull/1820)
27+
- (plugin-network-breadcrumbs, plugin-electron-net-breadcrumbs) *Breaking change*: The `request` metadata field in network breadcrumbs has been renamed to `url` and is no longer pre-pended with the HTTP method [#1988](https://github.com/bugsnag/bugsnag-js/pull/1988)
28+
- (plugin-network-breadcrumbs, plugin-electron-net-breadcrumbs) Add `method` metadata field to network breadcrumbs [#1988](https://github.com/bugsnag/bugsnag-js/pull/1988)
29+
- (plugin-network-breadcrumbs, plugin-electron-net-breadcrumbs) Add `duration` metadata field to network breadcrumbs [#1903](https://github.com/bugsnag/bugsnag-js/pull/1903)
30+
- (react-native) Update bugsnag-android from v5.32.2 to [v6.6.1](https://github.com/bugsnag/bugsnag-android/blob/next/CHANGELOG.md#661-2024-07-03)
31+
332
## [7.25.1] - 2024-08-27
433

534
### Changed

UPGRADING.md

+77
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,83 @@
11
Upgrading
22
=========
33

4+
## 7.x to 8.x
5+
6+
As well as some bug fixes and **breaking changes**, this major SDK release has the following key features:
7+
8+
- Improved API for NodeJS: the `Bugsnag` client can now be used to call SDK methods in the context of the current request
9+
- Breadcrumb support for NodeJS: we now support manual breadcrumbs and capture console breadcrumbs automatically
10+
- Improved session reporting for single page apps: a session is now created only once per page load to more accurately reflect a user's session in your app
11+
12+
### Amended triggers for automatically tracked sessions for web apps
13+
14+
To avoid over-reporting of session in browser-based apps, particularly SPAs, `replaceState` and `pushState` now no longer result in a new session. BugSnag sessions are now only created on full page loads. Depending on the type of web app you have, you may notice a drop in overall session numbers after upgrading.
15+
16+
### Node.js support
17+
18+
The minimum supported Node version is now v12.17.0.
19+
20+
### Breadcrumb support for Node.js
21+
22+
Breadcrumb support has been enabled for Node.js apps. This means you can call `Bugsnag.leaveBreadcrumb` to attach short log statements to each error report to help diagnose what events led to the error. However, no breadcrumbs are currently automatically collected.
23+
24+
### Context-aware `Bugsnag` calls for Node.js
25+
26+
When using `plugin-express`, `plugin-koa`, `plugin-restify`, or `plugin-contextualize`, a clone of the top-level Bugsnag client is made so that any subsequent changes made to the client (such as attaching metadata) only affect the scope of the current web request (or a function call, when using `plugin-contextualize`).
27+
28+
Prior to `bugsnag-js` v8, calls made to the top-level `Bugsnag` static interface were not aware of this context so users had to ensure they were calling methods on the correct client instance, i.e. the cloned client that was made available on `req.bugsnag` (or `ctx.bugsnag` for Koa). This wasn't ideal because if you wanted to interact with the Bugsnag client in some function deep in a call stack you would have to pass `req.bugsnag` all the way down, as calling `Bugsnag.notify` would not have contained the request metadata gathered by the plugin.
29+
30+
With version 8 of the notifier, top-level calls to `Bugsnag` are now context-aware. This means you can call `Bugsnag.notify` (or `Bugsnag.leaveBreadcrumb` etc.), and, if it was called within a context, the call will be forwarded to the correct cloned version of that client (i.e. for the particular request from which the call originated).
31+
32+
Express:
33+
34+
```diff
35+
app.get('/handled', function (req, res) {
36+
- req.bugsnag.notify(new Error('handled'))
37+
+ Bugsnag.notify(new Error('handled'))
38+
})
39+
```
40+
41+
Koa:
42+
43+
```diff
44+
app.use(async (ctx, next) => {
45+
if (ctx.path === '/handled') {
46+
- ctx.bugsnag.notify(new Error('handled'))
47+
+ Bugsnag.notify(new Error('handled'))
48+
await next()
49+
} else {
50+
await next()
51+
}
52+
})
53+
```
54+
55+
#### Notes
56+
57+
* `req.bugsnag` (and `ctx.bugsnag` in koa) is still present in version 8 of `bugsnag-js`, so you can continue using these as before.
58+
* There are rare situations on Express servers when this contextual storage can get lost, causing the data stored to become server-scoped and so affect all threads that are being executed. See our [online docs](https://docs.bugsnag.com/platforms/javascript/express/node-async/#context-loss-in-express-servers) for full details.
59+
60+
### BugSnag no longer prevents the Node.js process from exiting
61+
62+
Prior to `bugsnag-js` v8, unhandled errors in requests were caught using the deprecated Domain API and the error handler attached to the domain was preventing the termination of the Node process. With version 8, BugSnag no longer changes the normal behavior of the application and so uncaught exceptions thrown in request handlers (and `plugin-contextualize` callbacks, see below) will cause the process to terminate.
63+
64+
### `plugin-contextualize` behavior
65+
66+
Unhandled errors that occur within a contextualize context now respect the `autoDetectErrors` and `enabledErrorTypes` configuration options. Previously unhandled errors would have been caught regardless of the configuration.
67+
68+
As noted above, with this release uncaught exceptions occurring within a contextualize context will cause the Node process to terminate where previously the error handler incorrectly prevented this happening.
69+
70+
### `request` replaced with `url` and `method` in network breadcrumb metadata
71+
72+
Prior to v8, network breadcrumb metadata included a field named `request`, which contained the request URL prepended with the HTTP method (e.g. `"GET https://request-url.com/`). This has been replaced with two separate metadata fields named `url` and `method`, which contain the request URL and HTTP method respectively.
73+
74+
### Angular `onError` callbacks from `notify`
75+
76+
Prior to v8, calls to `notify` triggered change detection cycles which could affect performance. Using built-in Angular zones, this has [now been eliminated](https://github.com/bugsnag/bugsnag-js/pull/1861). However this means that any changes made to templates from the `onError` will no longer trigger a render and so will need to be manually re-rendered.
77+
78+
### Validation of BugSnag endpoints
79+
80+
As of v8, for consistency with other BugSnag platforms, if only one [endpoint](https://docs.bugsnag.com/platforms/javascript/configuration-options/#endpoints) is set in configuration, no events **or** sessions will be sent. To correctly setup BugSnag for on-premise, both `notify` and `sessions` endpoint should be set. This change reduces the possibility of a misconfigured client leaking data to the wrong BugSnag server.
481
## `bugsnag-react-native@*` to `@bugsnag/[email protected]`
582

683
As of `v7.3` of the [`bugsnag-js` monorepo](https://github.com/bugsnag/bugsnag-js) it contains Bugsnag's SDK for React Native. This additional notifier joins `@bugsnag/js` and `@bugsnag/expo` in its unified version scheme, so the first version of `@bugsnag/react-native` is `v7.3.0`.

bin/local-test-util

+3-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ async function installNotifiers (notifier) {
138138
await ex(`npm`, [
139139
`install`,
140140
`--no-package-lock`,
141-
`--no-save`
141+
`--no-save`,
142+
`--legacy-peer-deps`
142143
].concat(notifier
143144
? [
144145
`../../../../bugsnag-${notifier}-${require(`../packages/${notifier}/package.json`).version}.tgz`
@@ -161,6 +162,7 @@ async function installNgNotifier (notifier) {
161162
`install`,
162163
`--no-package-lock`,
163164
`--no-save`,
165+
`--legacy-peer-deps`,
164166
`../../../../../../bugsnag-browser-${require('../packages/browser/package.json').version}.tgz`,
165167
`../../../../../../bugsnag-js-${require('../packages/js/package.json').version}.tgz`,
166168
`../../../../../../bugsnag-node-${require('../packages/node/package.json').version}.tgz`,

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ services:
9393
command: --fail-fast --retry 2
9494
environment:
9595
<<: *common-environment
96-
NODE_VERSION: "${NODE_VERSION:-10}"
97-
COMPOSE_PROJECT_NAME: "node${NODE_VERSION:-10}"
96+
NODE_VERSION: "${NODE_VERSION:-12}"
97+
COMPOSE_PROJECT_NAME: "node${NODE_VERSION:-12}"
9898
NETWORK_NAME: "${BUILDKITE_JOB_ID:-js-maze-runner}"
9999
DEBUG:
100100
networks:

dockerfiles/Dockerfile.browser

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ RUN npm pack --verbose packages/web-worker/
2626
COPY test/browser/features test/browser/features
2727

2828
WORKDIR /app/test/browser/features/fixtures
29-
RUN npm install --no-package-lock --no-save ../../../../bugsnag-browser-*.tgz
30-
RUN npm install --no-package-lock --no-save ../../../../bugsnag-plugin-react-*.tgz
31-
RUN npm install --no-package-lock --no-save ../../../../bugsnag-plugin-vue-*.tgz
32-
RUN npm install --no-package-lock --no-save ../../../../bugsnag-web-worker-*.tgz
29+
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-browser-*.tgz
30+
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-plugin-react-*.tgz
31+
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-plugin-vue-*.tgz
32+
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-web-worker-*.tgz
3333
WORKDIR plugin_angular/ng
34-
RUN npm install --no-package-lock --no-save \
34+
RUN npm install --no-package-lock --no-save --legacy-peer-deps \
3535
../../../../../../bugsnag-plugin-angular-*.tgz \
3636
../../../../../../bugsnag-node-*.tgz \
3737
../../../../../../bugsnag-browser-*.tgz \

dockerfiles/Dockerfile.react-native-android-builder-java-11-node-16

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ARG REG_NPM_EMAIL
1414
RUN echo "_auth=$REG_BASIC_CREDENTIAL" >> ~/.npmrc
1515
RUN echo "email=$REG_NPM_EMAIL" >> ~/.npmrc
1616
RUN echo "always-auth=true" >> ~/.npmrc
17+
RUN echo "legacy-peer-deps=true" >> ~/.npmrc
1718

1819
# gradle / artifactory auth
1920
ARG MAVEN_REPO_URL

dockerfiles/Dockerfile.react-native-cli-android-builder

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ RUN echo "registry=$REGISTRY_URL" >> ~/.npmrc
2222
RUN echo "_auth=$REG_BASIC_CREDENTIAL" >> ~/.npmrc
2323
RUN echo "email=$REG_NPM_EMAIL" >> ~/.npmrc
2424
RUN echo "always-auth=true" >> ~/.npmrc
25+
RUN echo "legacy-peer-deps=true" >> ~/.npmrc
2526

2627
# Now copy in all the files needed to build
2728
COPY .git .git

examples/js/plain-node/app.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ process.stdin.on('data', function (d) {
3737
switch (d) {
3838
case 'u': return unhandledError()
3939
case 'h': return handledError()
40-
//case 'l': return leaveBreadcrumb()
40+
case 'l': return leaveBreadcrumb()
4141
case 'o': return onError()
4242
default: return unknown(d)
4343
}
@@ -59,7 +59,6 @@ function handledError () {
5959
Bugsnag.notify(new Error('scheduling clash'))
6060
}
6161

62-
// TODO Breadcrumbs not yet implemented for Node
6362
function leaveBreadcrumb () {
6463
console.log('leaving a breadcrumb…')
6564
// you can record all kinds of events which will be sent along with error reports

examples/ts/plain-node/src/app.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ process.stdin.on('data', function (d: Buffer) {
3939
switch (str) {
4040
case 'u': return unhandledError()
4141
case 'h': return handledError()
42-
//case 'l': return leaveBreadcrumb()
42+
case 'l': return leaveBreadcrumb()
4343
case 'o': return onError()
4444
default: return unknown(str)
4545
}
@@ -61,7 +61,6 @@ function handledError () {
6161
Bugsnag.notify(new Error('scheduling clash'))
6262
}
6363

64-
// TODO Breadcrumbs not yet implemented for Node
6564
function leaveBreadcrumb () {
6665
console.log('leaving a breadcrumb…')
6766
// you can record all kinds of events which will be sent along with error reports

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ module.exports = {
9393
], {
9494
testEnvironment: 'node',
9595
testMatch: [
96+
'<rootDir>/packages/node/test/**/*.test.[jt]s',
9697
'<rootDir>/packages/node/test/integration/**/*.test.[jt]s'
9798
]
9899
}),

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "7.25.1"
6+
"version": "8.0.0-alpha.13"
77
}

packages/browser/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser/package.json

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bugsnag/browser",
3-
"version": "7.25.0",
3+
"version": "8.0.0-alpha.13",
44
"main": "dist/bugsnag.js",
55
"types": "types/bugsnag.d.ts",
66
"description": "Bugsnag error reporter for browser JavaScript",
@@ -30,26 +30,25 @@
3030
"author": "Bugsnag",
3131
"license": "MIT",
3232
"devDependencies": {
33-
"@bugsnag/core": "^7.0.1",
34-
"@bugsnag/delivery-x-domain-request": "^7.25.0",
35-
"@bugsnag/delivery-xml-http-request": "^7.25.0",
36-
"@bugsnag/plugin-app-duration": "^7.25.0",
37-
"@bugsnag/plugin-browser-context": "^7.25.0",
38-
"@bugsnag/plugin-browser-device": "^7.25.0",
39-
"@bugsnag/plugin-browser-request": "^7.25.0",
40-
"@bugsnag/plugin-browser-session": "^7.25.0",
41-
"@bugsnag/plugin-client-ip": "^7.25.0",
42-
"@bugsnag/plugin-console-breadcrumbs": "^7.25.0",
43-
"@bugsnag/plugin-inline-script-content": "^7.25.0",
44-
"@bugsnag/plugin-interaction-breadcrumbs": "^7.25.0",
45-
"@bugsnag/plugin-navigation-breadcrumbs": "^7.25.0",
46-
"@bugsnag/plugin-network-breadcrumbs": "^7.25.0",
47-
"@bugsnag/plugin-simple-throttle": "^7.25.0",
48-
"@bugsnag/plugin-strip-query-string": "^7.25.0",
49-
"@bugsnag/plugin-window-onerror": "^7.25.0",
50-
"@bugsnag/plugin-window-unhandled-rejection": "^7.25.0"
33+
"@bugsnag/delivery-x-domain-request": "^8.0.0-alpha.13",
34+
"@bugsnag/delivery-xml-http-request": "^8.0.0-alpha.13",
35+
"@bugsnag/plugin-app-duration": "^8.0.0-alpha.13",
36+
"@bugsnag/plugin-browser-context": "^8.0.0-alpha.13",
37+
"@bugsnag/plugin-browser-device": "^8.0.0-alpha.13",
38+
"@bugsnag/plugin-browser-request": "^8.0.0-alpha.13",
39+
"@bugsnag/plugin-browser-session": "^8.0.0-alpha.13",
40+
"@bugsnag/plugin-client-ip": "^8.0.0-alpha.13",
41+
"@bugsnag/plugin-console-breadcrumbs": "^8.0.0-alpha.13",
42+
"@bugsnag/plugin-inline-script-content": "^8.0.0-alpha.13",
43+
"@bugsnag/plugin-interaction-breadcrumbs": "^8.0.0-alpha.13",
44+
"@bugsnag/plugin-navigation-breadcrumbs": "^8.0.0-alpha.13",
45+
"@bugsnag/plugin-network-breadcrumbs": "^8.0.0-alpha.13",
46+
"@bugsnag/plugin-simple-throttle": "^8.0.0-alpha.13",
47+
"@bugsnag/plugin-strip-query-string": "^8.0.0-alpha.13",
48+
"@bugsnag/plugin-window-onerror": "^8.0.0-alpha.13",
49+
"@bugsnag/plugin-window-unhandled-rejection": "^8.0.0-alpha.13"
5150
},
5251
"dependencies": {
53-
"@bugsnag/core": "^7.25.0"
52+
"@bugsnag/core": "^8.0.0-alpha.13"
5453
}
5554
}

0 commit comments

Comments
 (0)