2

Maybe somebody faced the same problem as me or at least knows Sentry and is able to help me to fix it.

I see in my Sentry issues report that there are a lot of events called

enter image description here

I looked at breadcrumbs of the events and see they looks pretty the same. So before each exception, I can see the same scenario.

enter image description here

My team and I decided to ignore it in Sentry. I've written a piece of the following code, but after a new deploy, I see that the problem still exists, so a fix is needed. In a nutshell, my idea is to describe this breadcrumb as much as I can and ignore it if this is among the others and if error.message is object XMLHttpRequest.

Sentry.init({
        beforeSend(event, hint) {
            const error = hint.originalException;
            const failingDYApiBreadcrumb = event.breadcrumbs.find(
                (breadcrumb) =>
                    breadcrumb.category === 'xhr' &&
                    breadcrumb.data?.url ===
                        'https://px-eu.dynamicyield.com/clog' &&
                    breadcrumb.data?.status_code === 0,
            );
            if (
                error?.message?.match(/object XMLHttpRequest/i) &&
                failingDYApiBreadcrumb
            ) {
                return null;
            }
            return event;
        },
    });

Does anybody know what is wrong in my solution or how to resolve it in another way, maybe?

karo-s
  • 384
  • 2
  • 15

0 Answers0