Skip to content

Commit

Permalink
Update UPGRADING.md
Browse files Browse the repository at this point in the history
Co-authored-by: Gareth Thackeray <gareth.thackeray@smartbear.com>
  • Loading branch information
djskinner and Gareth Thackeray authored Jul 14, 2023
1 parent 49eca4a commit 20fb9c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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. 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).

Expand Down

0 comments on commit 20fb9c0

Please sign in to comment.