Sentry-javascript: Console logs are generated from instrument.ts file

Created on 22 Jul 2020  路  6Comments  路  Source: getsentry/sentry-javascript

Package + Version

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

Version:

5.20.0

Also happening in 5.19.2

Description

Similar to https://github.com/getsentry/sentry-react-native/issues/794. I followed the instructions there, but still all my logs are showing up as coming from instrument.ts:129

Needs Information

Most helpful comment

It's most likely that your bundler configuration is not including node_modules in the path. For example default, parcel-bundler is doing so, eg.

image

To blackbox it, I'd have to add instrumen.ts instead of trying to match on @sentry

image

image

All 6 comments

Can you show the screenshots of how are you blackboxing the script and what's the console output?
Also, do you need it for production or development? We are using this integration to transform console logs into event breadcrumbs. If you don't need them in development (or at all), you can turn it off:

```js
Sentry.init({
dsn: '_YOUR_DSN_',
integrations: [new Sentry.Integrations.Breadcrumbs({ console: false })]
})

Sure, the steps I followed below:

The console output below:
image

I only use breadcrumbs in development when I'm working on them. The rest of the time we don't add the DSN in development, so I could use the solution you propose. I would only need to remove it when working on breadcrumbs and put it back when I'm done.

I'm curious to know if I'm doing something wrong with the blackboxing, or if maybe I'm missing some other step somewhere else. If blackboxing worked I'd rather do that.

Thanks!

It's most likely that your bundler configuration is not including node_modules in the path. For example default, parcel-bundler is doing so, eg.

image

To blackbox it, I'd have to add instrumen.ts instead of trying to match on @sentry

image

image

We'll soon add a section to the docs explaining this
https://github.com/getsentry/sentry-docs/pull/1892

Interesting! I didn't know what blackboxing was doing, but now that you mentioned node_modules I realised I'm using sentry from the CDN. Adding instrument.ts works, but also does adding just browser.sentry-cdn.com. I guess blackboxing browser.sentry-cdn.com is the CDN equivalent of blackboxing /@sentry/.

Awesome, problem solved. Thanks!

Was this page helpful?
0 / 5 - 0 ratings