sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Events missing debug ID

Open InterstellarStella opened this issue 9 months ago • 4 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

7.108.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

Provided in the shadow ticket. Note that they are using wp-sentry.

Steps to Reproduce

  1. develop locally with webpack in development mode with webpack --watch --mode development (which, as opposed to what the documentation says, it still uploads the source maps to Sentry, although it shouldn't)
  2. The dist files generated by webpack locally in dev mode are gitignored, and are not uploaded to GitHub or the server. They are just for the user to preview locally.
  3. commit and push the source files to GitHub
  4. start the pipeline on Buddy.works, which
    1. pulls the source files from GitHub
    2. and then runs webpack --mode production to generate the dist files.
    3. It will then upload the generated _dist files to the server

Expected Result

Events are source mapped correctly.

Actual Result

After looking through how the rest of their events appear in Sentry, it looks like they are most likely generating and uploading source maps correctly. According to their logs, their source maps have debug IDs, and I am able to find them in their project settings too. However, their events do not have debug IDs, which is where things go wrong.

Since we do not have debug IDs available, we would fall back to the legacy source mapping method which uses releases, however, their source maps are not connected to their releases, so it's not possible to show readable code. Even if they were, though, the fact that their abs_path values in an event are not an exact match to the names of their uploaded files (there is a ver parameter appended at the end of the file name that does no exist in the uploaded source maps) would prevent Sentry from deminifying their stack traces still.

For a specific file, it is also unusual to see row 1 column 0, as it would most likely map to nothing even in working source maps.

So there are 2 issues to address here: Why are there no debug IDs in your events Why is that specific bundle showing row 1 column 0

┆Issue is synchronized with this Jira Improvement by Unito

InterstellarStella avatar May 02 '24 07:05 InterstellarStella

Hi,

Why are there no debug IDs in your events

I think this is the core question. Given wp-sentry isn't officially maintained by us I'm gonna tag @stayallive - do you have an idea why the browser SDK might not be attaching debug ids in wp-sentry? The relevant code is here. I just skimmed over wp-sentry and it seems it uses the browser SDK >7.47.0, so it should work 🤔

Lms24 avatar May 16 '24 09:05 Lms24

Also, to folks following this issue: Can you confirm that no errors sent from the browser SDK have debug ids? (Sorry if I missed this in the various tickets and threads around this issue)

Lms24 avatar May 16 '24 09:05 Lms24

Could this be a path mapping issue? I'm assuming OP develops a plugin or theme and they might not be in the path where Sentry would expect it to match uploaded sourcemaps.

There is no client config for this right? We have no special config set to disable anything as far as I'm aware, we bundle the CDN version of the builds and the latest plugin version bundles 7.112.2.

Anything I'm missing that would not client configuration to make this work?

stayallive avatar May 16 '24 09:05 stayallive

TLDR: The problem seems to be gone on new issues concerning the same JS file. But, even though Sentry shows the correct line and content of the source file, the path it's showing is wrong and if I click on it, it gives me a 404.

Hi, I'm the person this issue was opened for 👋🏻

@stayallive you're right, I'm working on our website's theme, and the content of the folder wp-content/themes/newzoo/ is the only part tracked by git and uploaded to GitHub, but the path mapping should be correct as other files within the same folder were mapping correctly.

Before this issue was opened there's been a long discussion between me and Stella via tickets, so you're all probably lacking a lot of context here.

Basically I had this issue in Sentry where wp-content/themes/newzoo/js/_dist/single--games.bundle failed to be mapped to its source file wp-content/themes/newzoo/js/_src/single--games.js: https://newzoo-com.sentry.io/share/issue/f56fc05f6b964da38d075cc4b110158f/

Other issues concerning files in the same folder as the above were mapping correctly, eg: https://newzoo-com.sentry.io/share/issue/00f6add9b4064aa685640939fa69ae87/

Although I'm only noticing now something odd. The two issues above show different paths to the source:

The issue that doesn't map, shows wp-content/themes/newzoo/js/_dist/single--games.bundle

The issue that maps correctly, shows wp-content/themes/newzoo/js/_dist/newzoo/js/_src/single--trendreports

↑ this one, even though is the one that works, shows a wrong path to the source:

wp-content/themes/newzoo/js/_dist/newzoo/js/_src/single--trendreports
                            ^^^^^^^^^^^^^^^^
                         this shouldn't be here

To sum it up, the source files are at wp-content/themes/newzoo/js/_src the dist files at wp-content/themes/newzoo/js/_dist and Sentry thinks the source files are at wp-content/themes/newzoo/js/_dist/newzoo/js/_src/

So ironically the one that did not work was the one with the correct mapping. It's somehow appending part of the src path to the full dist path.

I suspect that's why that was happening, though I have no idea why since both files were generated by the same webpack config. Is this something onwp-sentry's end? Sentry's? Or something I need to fix?

Like I said above, I can see the correct content in the stack trace, but the path is not correct for some reason, so if I click on it I get a 404:

CleanShotX - Arc  16 05 2024 at 15-31-11 @2x CleanShotX - Arc  16 05 2024 at 15-42-39

I went ahead and deleted all Code Mappings, recreated it by clicking on Set up Code Mapping on the issue screen, which then created a new wrong mapping again (which works at showing the src content, but 404s on click):

https://github.com/getsentry/sentry-javascript/assets/47320294/39ddb4ca-1bfc-44b5-b26c-22e79cd63298

alessandro-newzoo avatar May 16 '24 14:05 alessandro-newzoo

@alessandro-newzoo Since this seems to be an issue within Sentry itself and not the SDK I reposted your comment in the Sentry repo: https://github.com/getsentry/sentry/issues/71216 so that the right team can take a look.

lforst avatar May 21 '24 08:05 lforst

@lforst thank you!

alessandro-newzoo avatar May 21 '24 08:05 alessandro-newzoo

I'll close this to keep our issue stream clean. Feel free to still reach out anytime!

lforst avatar May 21 '24 08:05 lforst