Skip to content

autoWrapExpoRouterErrorBoundary is opt-in but could be the default #6738

Description

@alwx

autoWrapExpoRouterErrorBoundary (in withSentryConfig/getSentryExpoConfig, packages/core/src/js/tools/metroconfig.ts) auto-wraps Expo Router's per-route ErrorBoundary re-exports with Sentry.wrapExpoRouterErrorBoundary at build time, so render-phase errors that hit the fallback get captured without the user touching their route files.

It currently defaults to false (#6347), so Expo Router users only get this error capture if they know the option exists and opt in explicitly:

module.exports = getSentryExpoConfig(__dirname, {
  autoWrapExpoRouterErrorBoundary: true,
});

Since the whole point is capturing errors users wouldn't otherwise think to instrument, most Expo Router apps are silently missing this coverage. Worth considering flipping the default to true in the next major version.

Needs scoping before landing:

  • Confirm the babel rewrite (detecting export { ErrorBoundary } from 'expo-router' and aliased variants) is safe to apply unconditionally across the range of Expo Router versions/route layouts we support - it already skips files that already import wrapExpoRouterErrorBoundary, but should be validated against a wider set of real app structures.
  • Decide whether this should ship default-on directly in 9.0, or default-on with an escape hatch (autoWrapExpoRouterErrorBoundary: false) for a deprecation cycle.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions