# Add Crash Reporting to an Expo App

Yes. An agent reads your Expo app's error boundary and crash-reporting stub, wires in Sentry with the config plugin, and proves the build and type check still pass.

[Run this on Rush](https://cloud.getrush.ai/run/add-crash-reporting/expo/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads what the app already has for errors before adding anything. In an app generated from infinitered/ignite it opens `app/utils/crashReporting.ts` and finds the hook points already drawn: an `initCrashReporting` function whose body is commented-out `Sentry.init` and `Bugsnag.start` calls, an `ErrorType` enum with `FATAL` and `HANDLED`, and a `reportCrash` function that logs to the console under `__DEV__` and has commented `Sentry.captureException`, `crashlytics().recordError` and `Bugsnag.notify` lines for production. It reads `app/screens/ErrorScreen/ErrorBoundary.tsx`, whose `componentDidCatch` has a `// reportCrash(error)` comment, and `app/config/config.base.ts`, where `catchErrors` is `"always"`.

Then it reads how the app is built. `package.json` pins `expo` 55 and `react-native` 0.83, with scripts `compile` (`tsc --noEmit`), `lint:check`, `test` (Jest) and `build:ios:*` through `eas build --local`. `app.json` has `newArchEnabled: true`, the `plugins` list with `expo-localization`, `expo-font`, `expo-splash-screen`, `react-native-edge-to-edge` and `expo-build-properties`, and `app.config.ts` spreads `config.plugins` into `existingPlugins`, so a new config plugin belongs in `app.json` where the others are. `eas.json` defines `development`, `preview` and `production` profiles, and `app/config/config.prod.ts` holds production-only values and says secrets do not belong in JS.

The agent installs `@sentry/react-native` with `npx expo install` so the version matches the SDK, adds the `@sentry/react-native/expo` plugin to `app.json` with the organization and project read from `SENTRY_ORG` and `SENTRY_PROJECT` and the auth token left to `SENTRY_AUTH_TOKEN` in EAS secrets, never in the file. It fills in `initCrashReporting` with `Sentry.init` using a DSN from `app/config` per environment, `enabled` true only outside `__DEV__`, and `tracesSampleRate` set low, and makes `reportCrash` call `Sentry.captureException` with the `ErrorType` as a tag in production. It uncomments `reportCrash(error)` in `ErrorBoundary.componentDidCatch`, calls `initCrashReporting()` at the top of `app/app.tsx` before the providers mount, and wraps the exported `App` with `Sentry.wrap`.

Before pushing, it runs `yarn compile`, `yarn lint:check` and `yarn test` in its sandbox, and `npx expo config --type prebuild` to confirm the plugin resolves and the native config it would generate is well formed. It does not run an EAS build, because that needs the project's Expo account; instead the pull request description says which EAS secrets to add and which profile to build first. It opens the pull request and reads any workflow the repository runs on it, fixing a type or lint failure and pushing again.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add crash reporting with Sentry to this Expo app. Read app/utils/crashReporting.ts, app/screens/ErrorScreen/ErrorBoundary.tsx, app/app.tsx, app/config and app.json first. Install @sentry/react-native with npx expo install, add its Expo config plugin to app.json reading org, project and auth token from environment and EAS secrets rather than the file, implement initCrashReporting and reportCrash using the existing ErrorType enum, call initCrashReporting before the app renders and report from the error boundary. Keep Sentry disabled in development. Run the type check, lint and tests, and npx expo config --type prebuild, before you push. Do not run an EAS build. Open a pull request that lists the secrets to add and the first profile to build.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on a new branch that changes `package.json` and the lockfile to add `@sentry/react-native`, `app.json` to add its config plugin, `app/utils/crashReporting.ts` to implement `initCrashReporting` and `reportCrash`, `app/screens/ErrorScreen/ErrorBoundary.tsx` to report from `componentDidCatch`, `app/app.tsx` to initialise before render and wrap the root, and `app/config/config.dev.ts` and `config.prod.ts` to carry the DSN per environment. The description names `SENTRY_ORG`, `SENTRY_PROJECT` and `SENTRY_AUTH_TOKEN` as the EAS secrets to add and which `eas.json` profile to build first.

The proof in the pull request is the type check, lint and Jest output the agent ran, kept in the session's trajectory with every command, and the `expo config --type prebuild` output showing the plugin resolved. Any workflow the repository already runs on pull requests runs here too. No build artefact is claimed: a native build needs the project's Expo account and is the first thing the reviewer does after merging.

Before merging, a reviewer checks that the DSN in `config.prod.ts` is the right project, that enabling Sentry only outside `__DEV__` matches how they want development crashes handled, that source map upload is wanted on every EAS build or only production, and that `tracesSampleRate` is as low as they intend. Then they run the named EAS profile and trigger a test crash to see the first event arrive.

## Run it on every new Expo repository

Add a GitHub organization webhook for the `repository` event and, when one is `created` from your Expo template, have your server send this same request with that repository's URL in `resources`. Each repository gets its own sandbox, its own run and its own pull request, so every new app has crash reporting wired before its first store build. The Rush GitHub App must be installed on the repository; `GET /o/{org}/github` lists what it can reach.

Set a webhook URL on the API key and Rush POSTs `run.completed` or `run.failed` when each run's turn finishes, with `session_url` so your server can post the pull request link and the list of secrets to add. Send a fresh UUID as `request_id` with each request so a retry returns the run already started rather than a second pull request.

## Why run it on Rush?

Wiring crash reporting into an Expo app touches the config plugin, the app entry, the error boundary and the per-environment config, and the mistakes show up only as a type error or a plugin that fails to resolve at prebuild. On Rush the agent makes all of those edits in its own sandbox, runs `tsc --noEmit`, lint, Jest and `expo config --type prebuild` there before the first push, and reads whatever the repository's own workflow says on its pull request. Your machine installs nothing and your working tree stays where it is.

The result is evidence, not a claim. The trajectory keeps each command the agent ran with its output, the pull request lists the exact secrets and profile a reviewer needs, and nothing reaches the default branch until a person merges. Because each run is independent, the same request can add crash reporting to every app repository the team owns at once, one pull request each.

## Frequently asked questions

### Will it put my Sentry auth token or DSN in the repository?

The auth token never goes in the repository: the config plugin reads it from `SENTRY_AUTH_TOKEN` in EAS secrets or the environment, and the pull request names it. The DSN is not a secret, so it lives in `app/config/config.dev.ts` and `config.prod.ts` next to `API_URL`, which is where the Ignite boilerplate already keeps per-environment values.

### Does it run a native build to prove the plugin works?

No. An EAS build needs the project's Expo account and credentials, so the agent runs `npx expo config --type prebuild` to show the plugin resolves and the generated native config is well formed, and leaves the first real build to the reviewer with the profile named in the pull request. It never claims a build it did not run.

### Can it use Bugsnag or Crashlytics instead of Sentry?

Yes. The Ignite stub in `app/utils/crashReporting.ts` already has commented lines for all three. Name the service in the prompt and the agent installs that SDK, adds its config plugin or Firebase setup, and fills in the same `initCrashReporting` and `reportCrash` functions, so the rest of the app does not change.

### Will development crashes be sent?

Not by default. `Sentry.init` is enabled only outside `__DEV__`, and `reportCrash` keeps the existing behaviour of logging to the console and Reactotron under `__DEV__`. Ask in the prompt if you want a separate development DSN instead, and the agent adds it to `config.dev.ts`.

## More Expo jobs

- [Add Deep Links to an Expo App](https://getrush.ai/run/add-deep-links/expo/)
- [Add an EAS Build Workflow on GitHub Actions to an Expo App](https://getrush.ai/run/add-eas-build-workflow/expo/)
- [Set Up GitHub Actions CI for an Expo App](https://getrush.ai/run/add-github-actions-ci/expo/)

## The same job on other stacks

- [Add Crash Reporting to a Flutter App](https://getrush.ai/run/add-crash-reporting/flutter/)
- [Add Crash Reporting to a React Native App](https://getrush.ai/run/add-crash-reporting/react-native/)
- [Add Crash Reporting to a Tauri App](https://getrush.ai/run/add-crash-reporting/tauri/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
