is there a way to manually ignore exceptions through the Azure dashboard?

Claude Mokbel 0 Reputation points
2024-08-22T13:04:22.2466667+00:00

I have an exception that is showing up in the logs of my application that cannot be traced to anything in the code. It is being logged at the window level from window.onerror(). Suspicion is that it is coming from a chrome extension. Would like to ignore this exception but any code that I have written in the Global Error Handler using the JS SDK for app insights does not seem to catch this error before logging it. Not sure in what way to intercept this error. Would like to do as the title suggests. Manually ignore a specific exception straight from the app insights dashboard. is this possible?
User's image

Failed Method is unknown, if I try to unminify the error Call Stack it tells me that no source maps could be identified from the call stack.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,462 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mykhailo Romaniuk 0 Reputation points
    2025-02-06T16:37:20.3033333+00:00

    Hello,

    I have a similar issue and it sounds like it could be achieved with a Telemetry initializer, you can filter telemetry items based on their data:

    const insights = new ApplicationInsights({ ... });
    
    insights.addTelemetryInitializer((envelop) => {
      // Provide your custom conditions under which message shouldn't be sent
      const fromChromeExtension = 
        typeof envelop.data?.errorSrc === 'string' &&
        envelop.data.errorSrc.startsWith('window.onerror@chrome-extension');
    
      return !fromChromeExtension; // when false - telemetry item is not sent
    });
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.