More ways to debug Expo apps with the React Native SDK
In our last Expo post, we walked through the first wave of Expo-focused work in the Sentry React Native SDK: OTA update context, emergency launch detection, EAS Build Hooks, and image and asset instrumentation.
Since then, most of our Expo energy has gone into navigation. We’ve taken Expo Router observability from a manual, opt-in helper to a first-class, auto-registered integration that traces every navigation, correlates deep links, and captures the errors your routes throw. Plus, it’s wired up at build time, so you don’t have to write instrumentation code.
Here’s what we shipped and how to use it.
From manual to automatic observability
Instrumenting Expo Router used to mean wiring up the generic React Navigation integration yourself. You’d import useNavigationContainerRef, thread it through a useEffect, and call registerNavigationContainer. Now it’s a first-class integration that registers itself:
import { isRunningInExpoGo } from 'expo';
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: '__DSN__',
tracesSampleRate: 1.0,
integrations: [
Sentry.expoRouterIntegration({
enableTimeToInitialDisplay: !isRunningInExpoGo(),
}),
],
enableNativeFramesTracking: !isRunningInExpoGo(),
});The integration reads Expo Router’s internal navigation ref for you, reuses your existing reactNavigationIntegration if you have one, and does nothing on projects that don’t use Expo Router. Cold-start edge cases, such as Sentry.init() running before the Root Layout mounts, are handled for you: the integration retries until the navigation ref is ready instead of silently bailing out.
Trace every navigation
Screen-focus transactions work out of the box once the integration is registered. To also capture imperative navigation (the router.push() calls in your own code), wrap the router with Sentry.wrapExpoRouter:
import { useRouter } from 'expo-router';
import * as Sentry from '@sentry/react-native';
function HomeScreen() {
const router = Sentry.wrapExpoRouter(useRouter());
return <Button title="Open profile" onPress={() => router.push('/users/42')} />;
}It wraps the full set of methods: push, replace, navigate, back, dismiss, and prefetch. Every method emits a breadcrumb and a short-lived span. For instance, prefetch gets a navigation.prefetch span. The idle navigation transaction that follows gets tagged with navigation.method. The wrapper is idempotent and safe to apply everywhere.
Route attributes that can contain user identifiers (route.href, route.params, and concrete pathnames derived from string hrefs like /users/42) are gated behind sendDefaultPii, so they stay private by default. Templated object hrefs (for example, { pathname: '/users/[id]' }) are structural, so their route.name is always recorded. Note that with sendDefaultPii off, string hrefs that resolve to a concrete path are recorded as route.name: 'unknown' rather than a templated name.
Deep links, connected to what they open
A tap on a push notification or a marketing link is often where a session starts, and historically that context was disconnected from the navigation it caused. The SDK now correlates them. The next navigation that starts shortly after a deep link arrives is tagged with:
navigation.trigger: 'deeplink'deeplink.url(sanitized, respectssendDefaultPii)deeplink.dispatch_delay_ms: the gap between the URL arriving and navigation dispatching
This works on both cold start (Linking.getInitialURL()) and warm open (the url event), including the tricky case where Expo Router auto-handles the link before our own chain resolves.
Catching errors thrown by your routes
Expo Router renders a per-route ErrorBoundary, but errors caught there never made it to Sentry. Now you can capture them:
import { ErrorBoundary as ExpoErrorBoundary } from 'expo-router';
import * as Sentry from '@sentry/react-native';
export const ErrorBoundary = Sentry.wrapExpoRouterErrorBoundary(ExpoErrorBoundary);The wrapper captures the error with route context, marks the in-flight navigation transaction as errored, adds a breadcrumb under expo-router.error_boundary, and reports under the expo_router_error_boundary mechanism. Re-rendering boundaries won’t spam duplicates, because reporting is deduplicated for each instance of an error. Custom fallback components (anything matching { error, retry }) work as well.
If editing every route file sounds tedious, the SDK can do it for you at build time. The Sentry Babel plugin rewrites export { ErrorBoundary } from 'expo-router' into the wrapped version automatically:
// metro.config.js
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
module.exports = getSentryExpoConfig(__dirname, {
autoWrapExpoRouterErrorBoundary: true,
});Every route’s error boundary then reports to Sentry automatically, with no changes to your route files, so new screens are covered the moment you add them.
Sharper performance signals
We added two ways to make it clearer how well a screen is performing.
Mark time to full display
Time to Initial Display (TTID) fires when a screen first paints, but that often doesn’t include the bulk of the content users are looking for. Sentry.reportFullyDisplayed() lets you signal when data has loaded and the screen is usable, recorded as Time to Full Display (TTFD):
import * as Sentry from '@sentry/react-native';
function ProfileScreen() {
const { data } = useProfile();
useEffect(() => {
if (data) {
Sentry.reportFullyDisplayed();
}
}, [data]);
// ...
}Now you can measure the gap between TTID and TTFD and find where users are left waiting:
See timing for OTA updates
When you ship over the air with Expo Updates, it used to be hard to tell what was happening during a slow rollout. The Updates listener integration now records a timing span for each phase, app.update.check and app.update.download, so the time spent checking for and downloading an update shows up as an attributable duration in your traces.
Network requests, back on Expo SDK 56+
Expo SDK 56 and newer swap globalThis.fetch for a native implementation, which affects how the SDK captures network requests.
The SDK used to record fetch() requests through the older XMLHttpRequest API, which standard React Native’s fetch is built on. Expo’s native fetch doesn’t use XMLHttpRequest, so on SDK 56 those requests stopped showing up in traces and breadcrumbs, and nothing warned you about it. The SDK now detects Expo’s native fetch and tracks those requests directly, recording each one once. You don’t need to change anything, and apps that don’t use Expo’s native fetch work the same as before.
If you upgraded an Expo app to SDK 56 and your network requests went missing from traces, this is why.
Better source maps for Expo builds
Everything depends on readable stack traces. A navigation trace or a route error isn’t much use if it points at minified line 1, column 90000. So we tightened up the source map path for Expo. There’s now a dedicated package for uploading, @sentry/expo-upload-sourcemaps, and the SDK warns you at Metro startup when a prebuilt native project is missing Sentry configuration, so you aren’t left wondering where your data went in production.
Upgrade
Everything above ships in the latest @sentry/react-native:
npx expo install @sentry/react-nativeAdd expoRouterIntegration(), turn on autoWrapExpoRouterErrorBoundary, and you’ve got navigation traces, deep link correlation, and route error capture with almost no code. See the Sentry Expo setup guide for the full configuration.