Skip to content

Commit

Permalink
Merge pull request #2192 from bugsnag/release/v8.0.0
Browse files Browse the repository at this point in the history
Release v8.0.0
  • Loading branch information
gingerbenw authored Aug 29, 2024
2 parents 5debffd + 00ea043 commit 5b33e20
Show file tree
Hide file tree
Showing 294 changed files with 83,678 additions and 14,361 deletions.
7 changes: 3 additions & 4 deletions .buildkite/basic/node-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ steps:
depends_on: "node-maze-runner-image"
timeout_in_minutes: 30
matrix:
- 4
- 6
- 8
- 10
- 12
- 14
- 16
- 18
- 20
plugins:
docker-compose#v4.12.0:
run: node-maze-runner
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## [8.0.0] - 2024-08-29

### Summary

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:

- Improved API for NodeJS: the `Bugsnag` client can now be used to call SDK methods in the context of the current request
- Breadcrumb support for NodeJS: we now support manual breadcrumbs and capture console breadcrumbs automatically
- 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

### Added

- (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)
- Support error correlation properties in event payloads [#2174](https://github.com/bugsnag/bugsnag-js/pull/2174)

### Fixed

- (plugin-angular) Prevent excess change detection cycles when calling `Bugsnag.notify` [#1861](https://github.com/bugsnag/bugsnag-js/pull/1861)

### Changed

- (node) Enable breadcrumbs and context-scoped calls [#1927](https://github.com/bugsnag/bugsnag-js/pull/1927)
- (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)
- (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)
- (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)
- (plugin-network-breadcrumbs, plugin-electron-net-breadcrumbs) Add `method` metadata field to network breadcrumbs [#1988](https://github.com/bugsnag/bugsnag-js/pull/1988)
- (plugin-network-breadcrumbs, plugin-electron-net-breadcrumbs) Add `duration` metadata field to network breadcrumbs [#1903](https://github.com/bugsnag/bugsnag-js/pull/1903)
- (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)

## [7.25.1] - 2024-08-27

### Changed
Expand Down
77 changes: 77 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,83 @@
Upgrading
=========

## 7.x to 8.x

As well as some bug fixes and **breaking changes**, this major SDK release has the following key features:

- Improved API for NodeJS: the `Bugsnag` client can now be used to call SDK methods in the context of the current request
- Breadcrumb support for NodeJS: we now support manual breadcrumbs and capture console breadcrumbs automatically
- 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

### Amended triggers for automatically tracked sessions for web apps

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.

### Node.js support

The minimum supported Node version is now v12.17.0.

### Breadcrumb support for Node.js

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.

### Context-aware `Bugsnag` calls for Node.js

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`).

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.

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).

Express:

```diff
app.get('/handled', function (req, res) {
- req.bugsnag.notify(new Error('handled'))
+ Bugsnag.notify(new Error('handled'))
})
```

Koa:

```diff
app.use(async (ctx, next) => {
if (ctx.path === '/handled') {
- ctx.bugsnag.notify(new Error('handled'))
+ Bugsnag.notify(new Error('handled'))
await next()
} else {
await next()
}
})
```

#### Notes

* `req.bugsnag` (and `ctx.bugsnag` in koa) is still present in version 8 of `bugsnag-js`, so you can continue using these as before.
* 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.

### BugSnag no longer prevents the Node.js process from exiting

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.

### `plugin-contextualize` behavior

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.

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.

### `request` replaced with `url` and `method` in network breadcrumb metadata

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.

### Angular `onError` callbacks from `notify`

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.

### Validation of BugSnag endpoints

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.
## `bugsnag-react-native@*` to `@bugsnag/[email protected]`

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`.
Expand Down
4 changes: 3 additions & 1 deletion bin/local-test-util
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ async function installNotifiers (notifier) {
await ex(`npm`, [
`install`,
`--no-package-lock`,
`--no-save`
`--no-save`,
`--legacy-peer-deps`
].concat(notifier
? [
`../../../../bugsnag-${notifier}-${require(`../packages/${notifier}/package.json`).version}.tgz`
Expand All @@ -161,6 +162,7 @@ async function installNgNotifier (notifier) {
`install`,
`--no-package-lock`,
`--no-save`,
`--legacy-peer-deps`,
`../../../../../../bugsnag-browser-${require('../packages/browser/package.json').version}.tgz`,
`../../../../../../bugsnag-js-${require('../packages/js/package.json').version}.tgz`,
`../../../../../../bugsnag-node-${require('../packages/node/package.json').version}.tgz`,
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ services:
command: --fail-fast --retry 2
environment:
<<: *common-environment
NODE_VERSION: "${NODE_VERSION:-10}"
COMPOSE_PROJECT_NAME: "node${NODE_VERSION:-10}"
NODE_VERSION: "${NODE_VERSION:-12}"
COMPOSE_PROJECT_NAME: "node${NODE_VERSION:-12}"
NETWORK_NAME: "${BUILDKITE_JOB_ID:-js-maze-runner}"
DEBUG:
networks:
Expand Down
10 changes: 5 additions & 5 deletions dockerfiles/Dockerfile.browser
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN npm pack --verbose packages/web-worker/
COPY test/browser/features test/browser/features

WORKDIR /app/test/browser/features/fixtures
RUN npm install --no-package-lock --no-save ../../../../bugsnag-browser-*.tgz
RUN npm install --no-package-lock --no-save ../../../../bugsnag-plugin-react-*.tgz
RUN npm install --no-package-lock --no-save ../../../../bugsnag-plugin-vue-*.tgz
RUN npm install --no-package-lock --no-save ../../../../bugsnag-web-worker-*.tgz
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-browser-*.tgz
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-plugin-react-*.tgz
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-plugin-vue-*.tgz
RUN npm install --no-package-lock --no-save --legacy-peer-deps ../../../../bugsnag-web-worker-*.tgz
WORKDIR plugin_angular/ng
RUN npm install --no-package-lock --no-save \
RUN npm install --no-package-lock --no-save --legacy-peer-deps \
../../../../../../bugsnag-plugin-angular-*.tgz \
../../../../../../bugsnag-node-*.tgz \
../../../../../../bugsnag-browser-*.tgz \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG REG_NPM_EMAIL
RUN echo "_auth=$REG_BASIC_CREDENTIAL" >> ~/.npmrc
RUN echo "email=$REG_NPM_EMAIL" >> ~/.npmrc
RUN echo "always-auth=true" >> ~/.npmrc
RUN echo "legacy-peer-deps=true" >> ~/.npmrc

# gradle / artifactory auth
ARG MAVEN_REPO_URL
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile.react-native-cli-android-builder
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN echo "registry=$REGISTRY_URL" >> ~/.npmrc
RUN echo "_auth=$REG_BASIC_CREDENTIAL" >> ~/.npmrc
RUN echo "email=$REG_NPM_EMAIL" >> ~/.npmrc
RUN echo "always-auth=true" >> ~/.npmrc
RUN echo "legacy-peer-deps=true" >> ~/.npmrc

# Now copy in all the files needed to build
COPY .git .git
Expand Down
3 changes: 1 addition & 2 deletions examples/js/plain-node/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ process.stdin.on('data', function (d) {
switch (d) {
case 'u': return unhandledError()
case 'h': return handledError()
//case 'l': return leaveBreadcrumb()
case 'l': return leaveBreadcrumb()
case 'o': return onError()
default: return unknown(d)
}
Expand All @@ -59,7 +59,6 @@ function handledError () {
Bugsnag.notify(new Error('scheduling clash'))
}

// TODO Breadcrumbs not yet implemented for Node
function leaveBreadcrumb () {
console.log('leaving a breadcrumb…')
// you can record all kinds of events which will be sent along with error reports
Expand Down
3 changes: 1 addition & 2 deletions examples/ts/plain-node/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ process.stdin.on('data', function (d: Buffer) {
switch (str) {
case 'u': return unhandledError()
case 'h': return handledError()
//case 'l': return leaveBreadcrumb()
case 'l': return leaveBreadcrumb()
case 'o': return onError()
default: return unknown(str)
}
Expand All @@ -61,7 +61,6 @@ function handledError () {
Bugsnag.notify(new Error('scheduling clash'))
}

// TODO Breadcrumbs not yet implemented for Node
function leaveBreadcrumb () {
console.log('leaving a breadcrumb…')
// you can record all kinds of events which will be sent along with error reports
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ module.exports = {
], {
testEnvironment: 'node',
testMatch: [
'<rootDir>/packages/node/test/**/*.test.[jt]s',
'<rootDir>/packages/node/test/integration/**/*.test.[jt]s'
]
}),
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "7.25.1"
"version": "8.0.0-alpha.13"
}
2 changes: 1 addition & 1 deletion packages/browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 19 additions & 20 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/browser",
"version": "7.25.0",
"version": "8.0.0-alpha.13",
"main": "dist/bugsnag.js",
"types": "types/bugsnag.d.ts",
"description": "Bugsnag error reporter for browser JavaScript",
Expand Down Expand Up @@ -30,26 +30,25 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
"@bugsnag/core": "^7.0.1",
"@bugsnag/delivery-x-domain-request": "^7.25.0",
"@bugsnag/delivery-xml-http-request": "^7.25.0",
"@bugsnag/plugin-app-duration": "^7.25.0",
"@bugsnag/plugin-browser-context": "^7.25.0",
"@bugsnag/plugin-browser-device": "^7.25.0",
"@bugsnag/plugin-browser-request": "^7.25.0",
"@bugsnag/plugin-browser-session": "^7.25.0",
"@bugsnag/plugin-client-ip": "^7.25.0",
"@bugsnag/plugin-console-breadcrumbs": "^7.25.0",
"@bugsnag/plugin-inline-script-content": "^7.25.0",
"@bugsnag/plugin-interaction-breadcrumbs": "^7.25.0",
"@bugsnag/plugin-navigation-breadcrumbs": "^7.25.0",
"@bugsnag/plugin-network-breadcrumbs": "^7.25.0",
"@bugsnag/plugin-simple-throttle": "^7.25.0",
"@bugsnag/plugin-strip-query-string": "^7.25.0",
"@bugsnag/plugin-window-onerror": "^7.25.0",
"@bugsnag/plugin-window-unhandled-rejection": "^7.25.0"
"@bugsnag/delivery-x-domain-request": "^8.0.0-alpha.13",
"@bugsnag/delivery-xml-http-request": "^8.0.0-alpha.13",
"@bugsnag/plugin-app-duration": "^8.0.0-alpha.13",
"@bugsnag/plugin-browser-context": "^8.0.0-alpha.13",
"@bugsnag/plugin-browser-device": "^8.0.0-alpha.13",
"@bugsnag/plugin-browser-request": "^8.0.0-alpha.13",
"@bugsnag/plugin-browser-session": "^8.0.0-alpha.13",
"@bugsnag/plugin-client-ip": "^8.0.0-alpha.13",
"@bugsnag/plugin-console-breadcrumbs": "^8.0.0-alpha.13",
"@bugsnag/plugin-inline-script-content": "^8.0.0-alpha.13",
"@bugsnag/plugin-interaction-breadcrumbs": "^8.0.0-alpha.13",
"@bugsnag/plugin-navigation-breadcrumbs": "^8.0.0-alpha.13",
"@bugsnag/plugin-network-breadcrumbs": "^8.0.0-alpha.13",
"@bugsnag/plugin-simple-throttle": "^8.0.0-alpha.13",
"@bugsnag/plugin-strip-query-string": "^8.0.0-alpha.13",
"@bugsnag/plugin-window-onerror": "^8.0.0-alpha.13",
"@bugsnag/plugin-window-unhandled-rejection": "^8.0.0-alpha.13"
},
"dependencies": {
"@bugsnag/core": "^7.25.0"
"@bugsnag/core": "^8.0.0-alpha.13"
}
}
Loading

0 comments on commit 5b33e20

Please sign in to comment.