Sentry-javascript: Console logs in development showing incorrect stack trace

Created on 3 Jun 2019  路  4Comments  路  Source: getsentry/sentry-javascript

Package + Version

  • [x] @sentry/browser
  • [ ] @sentry/node
  • [ ] raven-js
  • [ ] raven-node _(raven for node)_
  • [ ] other:

Version:

5.4.0

Description

Describe your issue in detail, ideally, you have a reproducible demo that you can show.

When using console in development, Sentry adds it to breadcrumbs. It is impossible to use console for debugging now since the browser console shows the line from Sentry source code for breadcrumbs as the event originator. The only workaround I found so far was to disable Sentry completely, ignoring the breadcrumb type in beforeBreadcrumb did not work either.

Question

Most helpful comment

Well if we want to play with the syntax, we can do

Sentry.init({
  dsn: '__dsn__',
  integrations: [
    development && new Sentry.Integrations.Breadcrumbs({
      console: false
    }),
  ].filter(Boolean),
})

to be perfect, but yes, this worked for me. Thanks again @kamilogorek !

All 4 comments

In Chrome: Devtools => Settings => Blackboxing => add sentry sdk bundle

// or

Per config:

if (development) {
  Sentry.init({
    dsn: '__dsn__',
    integrations: [new Sentry.Integrations.Breadcrumbs({
      console: false
    })]
  })
} else {
  // regular Sentry config
}

Thank you @kamilogorek !

Instead of doing if else, you can also do like this:

init({
   dsn: '__dsn__',
   ...(development && {
      integrations: [
         new Sentry.Integrations.Breadcrumbs({ console: false }),
      ],
   }),
   // regular Sentry config

Well if we want to play with the syntax, we can do

Sentry.init({
  dsn: '__dsn__',
  integrations: [
    development && new Sentry.Integrations.Breadcrumbs({
      console: false
    }),
  ].filter(Boolean),
})

to be perfect, but yes, this worked for me. Thanks again @kamilogorek !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

THPubs picture THPubs  路  3Comments

nicolezhu picture nicolezhu  路  3Comments

jaylinski picture jaylinski  路  3Comments

dimmduh picture dimmduh  路  3Comments

hinok picture hinok  路  3Comments