Package + Version
@sentry/react 6.10.0
Description
I’ve been mostly following React | Sentry Documentation to try and set up Sentry to an existing React app. The only thing I have done differently is removing the BrowserTracing
part of the config (I started off with that, but removing it didn’t seem to change the problem I have, so this helps to simplify the issue), as I don’t care so much about the performance tracing side of things for now, so it looks like the following:
Sentry.init({
dsn: "https://xxx@xxx.ingest.sentry.io/xxxxxxx",
environment: process.env.NODE_ENV,
debug: true, // turned this on for now to help debugging...
release: `${process.env.NODE_ENV}-test`, // this is temporary whilst testing
});
Then, I followed the ErrorBoundary
guide and set one up like so, before using it to wrap around the entire app at the root level:
<Sentry.ErrorBoundary
beforeCapture={(scope) => {
scope.setTag("isFatal", isFatal);
}}
fallback={<ErrorFallback isFatal={isFatal} />}
{...otherProps}
>
{children}
</Sentry.ErrorBoundary>
I then made a page component deliberately throw an error when navigating to it, and unsurprisingly I get the following error:
Error: deliberate error
ProfilePage
src/features/profile/view/ProfilePage.tsx:37
34 |
35 | const { data: user, error, isLoading } = useCurrentUser();
36 |
> 37 | throw new Error("deliberate error");
| ^ 38 | // eslint-disable-next-line
39 | return (
40 | <>
View compiled
▶ 4 stack frames were collapsed.
HTMLUnknownElement.sentryWrapped
src/helpers.ts:87
84 | // NOTE: If you are a Sentry user, and you are seeing this stack frame, it
85 | // means the sentry.javascript SDK caught an error invoking your application code. This
86 | // is expected behavior and NOT indicative of a bug with sentry.javascript.
> 87 | return fn.apply(this, wrappedArguments);
| ^ 88 | } catch (ex) {
89 | ignoreNextOnError();
90 |
The error snippet there clearly shows that Sentry has caught the uncaught exception in my code, except it’s not being sent to Sentry as an issue when I checked my dashboard on Sentry! I’ve even tried using the DebugIntegration
from @sentry/integrations
to see if the events are being passed through correctly and it looks like they are based off the following screenshot:
The last thing in case it might be helpful - I’m using Create React App for the project, also on the latest stable version of react-scripts
(4.0.3)
I’m at a bit of a lost end here as to what else I could try! Any suggestions on what else I may have overlooked would be appreciated