All jobs

Add Crash Reporting to a Tauri App

Yes. An agent wires Sentry into both halves of a Tauri app, the Rust process and the webview, keeps it silent without a DSN, and opens a pull request.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

A Tauri app crashes in two places, and the agent reads both before touching either. In an app like EcoPasteHub/EcoPaste, src-tauri/src/lib.rs builds the Tauri 2 app in run(): it registers tauri_plugin_log with a LogDir target, adding Stdout and Webview targets only under debug_assertions, then single_instance, os, global_shortcut, the updater, dialog and opener, and a long generate_handler! list of commands. Errors flow through anyhow and thiserror into a core::AppError type. On the other side, src/main.tsx renders <App /> inside a Suspense with no error boundary, so a thrown render error unmounts the whole window. package.json runs on pnpm@10.33.1 with biome for lint and tsc --noEmit for types, and .github/workflows/pr-check.yml runs those plus cargo fmt, cargo clippy -D warnings and cargo test on macOS and Windows runners.

For the Rust side the agent adds the tauri-plugin-sentry crate to src-tauri/Cargo.toml and, at the top of run(), initialises Sentry from a DSN read at build time through an environment variable, with release set from the crate version. The plugin registers before the others so a panic in any later plugin's setup is caught, and the panic hook it installs reports the backtrace without replacing the existing log::error! calls, which keep writing to the log directory. When the variable is unset the client is never created, so a developer's local build sends nothing and the behaviour is unchanged.

For the webview it adds @sentry/react and the plugin's JavaScript package, initialises them in src/main.tsx from import.meta.env.VITE_SENTRY_DSN, and wraps <App /> in Sentry's ErrorBoundary with a small fallback so a render error shows a message instead of a blank window. The JavaScript side forwards its events through the Rust plugin, which means one DSN, one release tag and breadcrumbs from both processes in the same event; that forwarding needs a permission in src-tauri/capabilities/default.json, which the agent adds. Nothing personal is attached: no clipboard content, no file paths from the user's disk, and sendDefaultPii stays off.

Then it proves the change the way pr-check.yml would: pnpm lint, pnpm tsc, cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings and cargo test in src-tauri, plus a cargo build with the DSN variable set and unset to show both paths compile. To see an event once, it adds a temporary panic behind a debug command, triggers it, confirms the event shape, and removes the command before committing.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add crash reporting with Sentry to this Tauri 2 app. In the Rust process use the tauri-plugin-sentry crate, initialised at the top of run() from an environment variable, registered before every other plugin, with the release taken from the crate version and nothing sent when the variable is unset. In the webview add @sentry/react, initialise it in src/main.tsx from VITE_SENTRY_DSN, wrap App in an ErrorBoundary with a plain fallback, and forward events through the Rust plugin; add the capability it needs. Keep the existing tauri_plugin_log setup. Attach no clipboard content or user file paths and leave PII off. Run biome, tsc, cargo fmt, clippy with -D warnings and cargo test, and build once with and once without the variable. Open a pull request that quotes each result and says where the DSN secret has to be set for release builds.",
  "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

The pull request changes src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/capabilities/default.json, package.json and src/main.tsx, adds the lockfile updates for both ecosystems, and adds one documented line to the release workflow's environment where the DSN secret is read. Its description quotes the lint, type, format, clippy and test results, the two builds with and without the variable, and a note on what each event contains: the panic message and backtrace from Rust, the component stack from React, the app version as the release, and the OS from the os plugin that was already registered.

A reviewer reads lib.rs to confirm the plugin is first in the builder chain and that the log plugin and its targets are untouched, checks main.tsx for the boundary and the absence of any user data in the init options, and looks at the capability file for the one added permission. The transcript at GET /o/{org}/sessions/{id}/messages holds every command's output and the one test event the agent triggered and then removed.

No DSN is committed. Until the secret is set in the release workflow, a release build behaves exactly like today's, and a developer's pnpm tauri dev sends nothing.

Run it on every new Tauri app

Teams that ship more than one desktop app tend to wire crash reporting the same way in each. Send POST /o/{org}/sessions with this body once per repository, with a request_id that is a UUID v5 of the repository name so a retried send returns the same run, and each app gets the same two-sided setup against its own lib.rs and entry file.

Set a webhook URL on the API key and the handler that receives run.completed can post the pull request link where the desktop team reviews; the session URL in the payload leads to the transcript with every build result.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

A Tauri change touches two toolchains, and proving it means a Rust build with clippy at -D warnings, a TypeScript check and a lint pass, on a machine with both installed. The sandbox has both, runs the five checks the repository's own workflow runs, and keeps the output in the transcript, so the pull request arrives with the same evidence CI will produce.

Crash reporting is also the kind of change where a quiet mistake costs trust: a DSN in the repository, a clipboard payload in an event, a panic hook that swallows the log line. Having the agent state in the pull request what each event contains and where the secret lives makes those the first things a reviewer reads.

Frequently asked questions

Does this send anything from my local development build?

No. The Rust client is only created when the DSN variable is set at build time, and the webview init is skipped when VITE_SENTRY_DSN is empty. A developer who never sets them runs the app exactly as before.

Will it replace the existing logging?

No. tauri_plugin_log and its LogDir, Stdout and Webview targets stay as they are. Sentry sits beside it: a log::error! still lands in the log file, and a panic additionally becomes an event with a backtrace.

What about symbol files so the stack traces are readable?

Uploading debug symbols for the Rust binary and source maps for the webview is a release-workflow step with its own token. The pull request says where it would go in the existing release workflow but does not add it; ask for it in a follow-up message to the session once the DSN is in place.

Can I use a different service than Sentry?

Name it in the prompt. The shape is the same for any service with a Rust panic hook and a browser SDK: initialise early in run(), boundary around the React root, no PII, nothing without a DSN. The agent reads that service's crate and package instead.

Does it need macOS or Windows to prove the build?

The sandbox runs the cargo and pnpm checks on Linux, which proves the code compiles and the lints pass; the platform-specific bundles are built by the repository's own CI on its macOS and Windows runners when the pull request opens.

More Tauri jobs

The same job on other stacks

Keep reading