T
TanStack7mo ago
complex-teal

Sentry setup

Hey, i'm using sentry integration but i have an issue that sentry doesn't capture errors thrown from react components. What's the proper way to use sentry's ErrorBoundary? The only way i could get it to catch is if i wrap individual page components with ErrorBoundary but this is sub-optimal having to wrap every page + errorComponent is useless in that case.
4 Replies
continuing-cyan
continuing-cyan7mo ago
cc @Cody De Arkland
complex-teal
complex-tealOP7mo ago
ok crap i think i've figured it out, in createRouter i have to use
defaultOnCatch(error, errorInfo) => Sentry.captureReactException(error, errorInfo)
defaultOnCatch(error, errorInfo) => Sentry.captureReactException(error, errorInfo)
instead of ErrorBoundary
optimistic-gold
optimistic-gold7mo ago
☝️ This is right, in createRouter, use the capture exception method
extended-salmon
extended-salmon7mo ago
do you use a separate router instance when passing it to the tanstack router plugin in sentry init?

Did you find this page helpful?