Skip to content
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

All Errors Being Marked as Third Party in NextJS with thirdPartyErrorFilteringIntegration enabled #13286

Open
3 tasks done
kerenkhatiwada opened this issue Aug 8, 2024 · 3 comments
Labels
Meta: Help Wanted Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@kerenkhatiwada
Copy link
Member

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.24.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

After configuring the thirdPartyErrorFilterIntegration to apply a tag to issues if they contain third-party stack frames, issues are incorrectly tagged as being from a third party.

  1. Add applicationKey to next.config.js and add the thirdPartyErrorFilterIntegration to Sentry.init()
    next.config.js
export default withSentryConfig(nextConfig, {
 
  applicationKey: "SentryKeyWithoutThirdParty",

});

Sentry.client.config.js

Sentry.init({
 
  integrations: [

    Sentry.thirdPartyErrorFilterIntegration({
      filterKeys: ["SentryKeyWithoutThirdParty"],
      behaviour: "apply-tag-if-contains-third-party-frames",

    }),
  ],

});
  1. build and run the Next.js app
  2. observe issues, always have the third_party_code tag set as true

https://org2-w7.sentry.io/issues/5615320176/events/33b552bfbbd8422db76734d93203f883/
https://org2-w7.sentry.io/settings/projects/nextjs14/source-maps/artifact-bundles/ff407422-2b74-5662-84b7-a70ebdde9fd3/?query=306f2601-113c-4fb2-9666-d8fe6b89d8e3
same result with behaviour: "apply-tag-if-exclusively-contains-third-party-frames"

Additional info:
window._sentryModuleMetadata is undefined:
Image

When behaviour is set to behaviour: "drop-error-if-contains-third-party-frames" events are dropped:
Image

Expected Result

third_party_code tag is set to False or not at all for errors occurring in my app

Actual Result

third_party_code tag is set as True for errors occurring in my app

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Aug 8, 2024
@lforst
Copy link
Member

lforst commented Aug 8, 2024

Hi, withSentryConfig doesn't have a applicationKey option yet. You need to set it as follows: https://github.com/getsentry/sentry-docs/blob/20f3e453407d74335b90bfdccd7a845ef8c69a4f/apps/changelog/next.config.mjs#L53-L56 (this is how we do it in our own changelog)

export default withSentryConfig(nextConfig, {
  unstable_sentryWebpackPluginOptions: {
    applicationKey: 'sentry-changelog',
  },
});

@Jac0xb
Copy link

Jac0xb commented Oct 8, 2024

Please add this

@lforst
Copy link
Member

lforst commented Oct 9, 2024

@Jac0xb PRs are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta: Help Wanted Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Status: No status
Development

No branches or pull requests

4 participants