Skip to content

How to group issues have different (dynamic) URLs in stack-trace that are generated by third-party script? #59420

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
meotimdihia opened this issue Nov 6, 2023 · 7 comments

Comments

@meotimdihia
Copy link

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

What are you trying to accomplish?

I want to merge these issues
image

I read the documentation https://docs.sentry.io/product/data-management-settings/event-grouping/fingerprint-rules/?original_referrer=https%3A%2F%2Fsentry.io%2F .I am not sure about it but I feel it won't solve the problem.

https://docs.sentry.io/platforms/javascript/guides/nextjs/usage/sdk-fingerprinting/?original_referrer=https%3A%2F%2Fwww.google.com%2F
SDK fingerprint seems not to help to merge similar issues too.

This is an example of an exception (JSON):

"exception": {
    "values": [
      {
        "type": "TypeError",
        "value": "null is not an object (evaluating 'document.querySelector(`#${id} div[id]`).shadowRoot')",
        "stacktrace": {
          "frames": [
            {
              "module": "comic/01-love-doesn-t-matter/qLm3U3nx-chapter-22-en",
              "filename": "app:///comic/01-love-doesn-t-matter/qLm3U3nx-chapter-22-en",
              "abs_path": "app:///comic/01-love-doesn-t-matter/qLm3U3nx-chapter-22-en",
              "lineno": 1,
              "colno": 291,
              "in_app": true
            }
          ]
        },
        "raw_stacktrace": {
          "frames": [
            {
              "filename": "app:///comic/01-love-doesn-t-matter/qLm3U3nx-chapter-22-en",
              "abs_path": "app:///comic/01-love-doesn-t-matter/qLm3U3nx-chapter-22-en",
              "lineno": 1,
              "colno": 291,
              "in_app": true
            }
          ]
        },
        "mechanism": {
          "type": "instrument",
          "handled": false,
          "data": {
            "function": "setInterval"
          }
        }
      }
    ]
  }

It looks like because the error was generated by a third-party script => the sourcemaps doesn't work here.
Dynamic path in next.js can't be solved.

How are you getting stuck?

I think we can merge these exceptions because they have the same value:

null is not an object (evaluating 'document.querySelector(#${id} div[id]).shadowRoot')

But it looks like Sentry merged them by stack trace.
Please guide me on how to merge them/solve this problem.

Where in the product are you?

Issues

Link

No response

DSN

No response

Version

23.10.1

@getsantry
Copy link
Contributor

getsantry bot commented Nov 6, 2023

Assigning to @getsentry/support for routing ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented Nov 6, 2023

Routing to @getsentry/product-owners-issues for triage ⏲️

@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 Nov 6, 2023
@scefali
Copy link
Contributor

scefali commented Nov 7, 2023

@meotimdihia Maybe you want to change your inbound filter rules to block these third party script errors? See: https://docs.sentry.io/product/data-management-settings/filtering/

@meotimdihia
Copy link
Author

meotimdihia commented Nov 8, 2023

@scefali it doesn't help in this case.
I have ended up filtering it in client SDK (next.js): (temporarily solution)

  beforeSend(event, hint) {

    
    const frames = event.exception?.values[0].stacktrace?.frames
    if (frames) {
      if (!frames[0].filename?.match(/\.(js|ts|tsx)$/)) {
        return null
      }
    }

I am not sure if I am doing it right.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 8, 2023
@jangjodi
Copy link
Contributor

jangjodi commented Nov 9, 2023

Thank you for bringing this to our attention @meotimdihia. We're currently working on an initiative to improve grouping for Next.js here

@lobsterkatie
Copy link
Member

@meotimdihia, as long as you have a reliable way of recognizing such events, you can either

a) filter them - the way you're doing it is the correct way,
b) capture them but group them by setting the fingerprint in the SDK (also in beforeSend), or
c) capture them but group them by using stacktrace rules to exclude the bad frames from the grouping calculation (docs here).

We don't automatically do any of these things because there's no way to consistently detect for everyone that either of those is the desired behavior (which indeed it might not be for some folks).

@jangjodi
Copy link
Contributor

I'm going to close this issue, as the solution Katie mentioned seemed to have worked. Please re-open this ticket if more support is needed.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

5 participants