Skip to content

Commit

Permalink
Merge branch 'v8-upgrading-node' of github.com:bugsnag/bugsnag-js int…
Browse files Browse the repository at this point in the history
…o v8-upgrading-node
  • Loading branch information
Dan Skinner committed Aug 31, 2023
2 parents a491231 + af68910 commit 3c87066
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ The minimum supported node version is now v12.17.0.

#### context-aware `Bugsnag` calls

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 a particular context (a request in the case of the web server plugins, and a function call in the case of `plugin-contextualize`).
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 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. that attached to `req.bugsnag` (or `ctx.bugsnag` for koa). This isn't ideal because if you wanted to call notify 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).
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 Bugsnag 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

Expand All @@ -38,11 +38,11 @@ app.use(async (ctx, next) => {
})
```

Note: `req.bugsnag` (and `ctx.bugsnag` in koa) is still present in v8 but marked as deprecated, and may be removed in a later version.
Note: `req.bugsnag` (and `ctx.bugsnag` in koa) is still present in version 8 of `bugsnag-js`.

#### breadcrumb support

Breadcrumb support has been enabled for node. This means you can call `Bugsnag.leaveBreacrumb` to attach short log statements to each error report to help diagnose what events led to the error.
Breadcrumb support has been enabled for node. 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.

Currently no breadcrumbs are automatically collected in node.

Expand Down

0 comments on commit 3c87066

Please sign in to comment.