Closed toniengelhardt closed 1 month ago
If somebody stumbles upon this, as a workaround we can wrap the useTrackEvent
composable like so to avoid the Sentry events:
import type { EventName, EventOptions } from '@barbapapazes/plausible-tracker'
/** Wrap original Plausible useTrackEvent composable to catch errors. */
export function usePlausibleEvent(eventName: EventName, options?: EventOptions) {
try {
useTrackEvent(eventName, options)
}
catch (error) {
console.info('Could not send Plausible event', error)
}
}
Turns out, the errors seem to be unrelated to this module. It's just that it triggers a lot of them. The workaround above effectively prevents them.
Closing...
I'm getting loads of "Failed to fetch" errors in Sentry when calling
useTrackEvent
(see screenshot).Is this a known issue? Might it be caused by browser extensions that prevent tracking or smth like that?
Related info from Sentry: https://sentry.io/answers/how-do-i-fix-the-typeerror-failed-to-fetch-error-in-javascript/