Skip to content

sendAmplitudeEvent Success and Failure callbacks are not called if request blocked at browser level (Brave Browser) #482

@lexwebb

Description

@lexwebb

I tried running one of our apps in the Brave browser which has native add/tracking built in.

Unfortately this breaks our app, as we are relying on the success and failure callbacks on the sendAmplitudeEvent method to do app functionality after an element has been interacted with.

The devtools show a net::ERR_BLOCKED_BY_CLIENT error, which bypasses Request's handling and requires a try catch to catch properly.

The issue seems to be that all errors are being swallowed by by an empty try-catch as can be seen on the following line:

This of course might be red herring, and there could be another way to catch errors thrown at this level. We've tried surrounding the whole method in a try-catch but this does not catch the error.

    try {
      sendAmplitudeEvent(
        {
          page: pageDetails,
          element: `${linkName} ${linkType}`,
          action: "Click",
        },
        eventProperties,
        onSuccess,
        onError
      );
    } catch {
      console.log("amplitude error");
    }

Would it be possible to have the error callback triggered as a result of the trycatch failure here? Or should we be looking into another solution?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions