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

[Feature request / question] A way to ignore errors based on the breadcrumbs? #1986

Closed
ian-whitestone opened this issue Jul 7, 2023 · 2 comments

Comments

@ian-whitestone
Copy link

ian-whitestone commented Jul 7, 2023

Description

We are using New Relic for observability in our React/NextJS application. It is currently causing this error to fire on many different pages throughout our application:

Unhandled Promise Rejection: Failed to fetch

CleanShot 2023-07-06 at 22 20 39@2x

As per the breadcrumbs, we can see this is always happening when New Relic is making a post request and it fails.

CleanShot 2023-07-06 at 22 15 46@2x

Describe the solution you'd like

A way in the UI, or in the bugsnag configuration, to ignore all errors that originate from this type of New Relic request.

Describe alternatives you've considered

  • From what I can tell, there isn't a way to explicitly "catch" and ignore errors from new relic, since it is an agent that runs in the background.
  • I saw this solution which lets us ignore errors based on the message text, but I don't want to ignore all Unhandled Promise Rejection: Failed to fetch errors, only ones that were caused by the New Relic fetch failing.
    • Perhaps there is a way to access the breadcrumbs when using the pattern the author suggests in this post?

Any thoughts or advice would be greatly appreciated!

@ian-whitestone ian-whitestone changed the title A method to ignore errors based on the breadcrumbs [Feature request / question] A way to ignore errors based on the breadcrumbs Jul 7, 2023
@ian-whitestone ian-whitestone changed the title [Feature request / question] A way to ignore errors based on the breadcrumbs [Feature request / question] A way to ignore errors based on the breadcrumbs? Jul 7, 2023
@johnkiely1
Copy link
Member

Hi @ian-whitestone,

It is possible to access the breadcrumb information from within an onError callback
Something like below would check if the most recent breadcrumb's request url is that of New Relic and then prohibit sending that event.

  onError: function (event) {
    if(event.breadcrumbs[event.breadcrumbs.length-1].metadata["request"].includes("bam.nr-data.com")){
      return false
    }
}

Obviously this is a relatively simplistic example and you could extend that to be more specific for your own needs.
Would something like this suit your needs?

@johnkiely1 johnkiely1 added the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Jul 10, 2023
@johnkiely1
Copy link
Member

As we haven't heard back from you in a while, going to close this out. I hope the above solution fits your needs but do let us know if not and we can reopen this as necessary.

@johnkiely1 johnkiely1 removed the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants