Skip to content

Scoped breadcrumbs (Sentry.withScope) #2009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 of 8 tasks
pgorecki opened this issue Apr 10, 2019 · 3 comments
Closed
4 of 8 tasks

Scoped breadcrumbs (Sentry.withScope) #2009

pgorecki opened this issue Apr 10, 2019 · 3 comments
Assignees

Comments

@pgorecki
Copy link

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.0.6

Description

I'm not sure if this is a bug or a lack of clear documentation.

The following code is a slightly modified snipped taken from https://docs.sentry.io/enriching-error-data/scopes/?platform=javascript

Sentry.addBreadcrumb({ message: 'My Breadcrumb' });
Sentry.withScope(scope => {
  scope.setTag("my-tag", "my value");
  scope.setLevel('warning');
  scope.addBreadcrumb({ message: 'scope breadcrumb' });
  // will be tagged with my-tag="my value"
  Sentry.captureException(new Error('oops!'));
});

Running the following code
will result in an isse with only 2 breadcrums:

  • generic | My Breadcrumb
  • exception | Error: oops!

I would expect to see the scope breadcrumb on the list of breadcrums. How can I capture an exception within a local scope, so that scope breadcrumbs are also reported?

@HazAT
Copy link
Member

HazAT commented Apr 10, 2019

If that is the case it's a bug we have to fix, we will look into this.

@the21st
Copy link

the21st commented Aug 11, 2020

This is happening to us in @sentry/node 5.20.1. The exact same setup described in this issue.

@sebneira
Copy link

Having the same issue with @sentry/node 5.29.0. Breadcrumbs won't be displayed in Sentry when using scope.addBreadcrumbs but will with Sentry.addBreadcrumbs.

As a matter of fact, the scope version won't trigger the beforeBreadcrumb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants