getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.87k stars 1.55k forks source link

console.logs showing up as instrument.ts in Firefox #9316

Closed wesbos closed 3 months ago

wesbos commented 11 months ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

7.73.0

Framework Version

"@sveltejs/kit": "^1.25.2",

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn: '...',
    tracesSampleRate: 1.0,

    // This sets the sample rate to be 10%. You may want this to be 100% while
    // in development and sample at a lower rate in production
    replaysSessionSampleRate: 0.1,

    // If the entire session is not sampled, use the below sample rate to sample
    // sessions when an error occurs.
    replaysOnErrorSampleRate: 1.0,

    // If you don't want to use Session Replay, just remove the line below:
    integrations: [new Replay()],
    environment: dev ? 'development' : 'production'
});

Steps to Reproduce

On the new Syntax site, our console.logs in firefox are showing up as from sentry’s instrument.ts.

I know chrome has a list to x-google-ignorelist (https://developer.chrome.com/articles/x-google-ignore-list/) scripts like this and show the real source, but turning that on in Firefox hides the logs entirely.

Using firefox' "ignore" option on both instrument.ts and the entire @sentry/utils package doesn't seem to change anything.

I think this is a new problem as I've not encountered this before and used firefox for years. Confirmed in Firefox developer 119 and stable 118.

Several github issues saying to just turn console breadcrumbs off, but that doesn’t seem to be a good fix because we want those as well.

Expected Result

it shows the source as authored

Actual Result

image

mydea commented 11 months ago

FWIW this is not actually FF only I think but happens everywhere, at least I've also seen it in Chrome.

Lms24 commented 10 months ago

Gonna change the package type to Browser as I believe this affects all SDKs, not just Svelte(kit).

microHoffman commented 10 months ago

I'd be interested in hearing a solution for this as well. I've found some solutions for Chrome with adding /@sentry/ and instrument.ts to Black Box, but I was not able to find any solution that works on Firefox.

mydea commented 10 months ago

I wonder if this is even possible at all 🤔 I've played around with this a bit and haven't found a way to make the dev tools show the "original" source of the console.log - as we always have to wrap it and re-call it from our wrapped variant 🤔 if anybody has a pointer or idea on how to do this, we'd be happy to hear about them!

wesbos commented 9 months ago

I also have not found a way in Firefox - perhaps we can ping someone from Firefox dev tools?

rodolfoBee commented 3 months ago

This is still an issue, when the JS sdk is not initialised or the breadcrumbs integration is removed, the console log point to the correct line (in my case script.js:158)

When initialising the SDK, the line always points to console.js:36

mydea commented 3 months ago

I fear there is nothing we can do about this from the SDK. There is an entry in the troubleshooting section here: https://docs.sentry.io/platforms/javascript/troubleshooting/

But that always requires manual setup in the browser, sadly. Does that work for you in firefox?

wesbos commented 3 months ago

The ignore trick never worked in Firefox. I ended up switching to Edge after 8 years on firefox because of little issues like this

mydea commented 3 months ago

Ah, yeah, that sucks. The little paper cuts 😬

I think we can still close this issue, nothing much we can do about this I believe...?

wesbos commented 3 months ago

Yep - kind of out of our hands. Thanks anyways