EAS Build Hooks

Capture EAS build failures and lifecycle events in Sentry.

EAS Build runs your app builds on Expo's infrastructure. When a build fails, the error can be hard to diagnose — it happens outside your local environment and outside your app. EAS Build Hooks let you send build lifecycle events directly to Sentry so you can track failures, correlate them with releases, and get notified when production builds break.

Add the Sentry EAS build hook scripts to your package.json:

package.json
Copied
{
  "scripts": {
    "eas-build-on-error": "sentry-eas-build-on-error",
    "eas-build-on-success": "sentry-eas-build-on-success",
    "eas-build-on-complete": "sentry-eas-build-on-complete"
  }
}

EAS Build automatically runs package.json scripts with these names at the corresponding lifecycle events. See the Expo npm hooks documentation for more details.

Set your DSN as an EAS secret or environment variable so it's available during builds:

Copied
eas env:create --name SENTRY_DSN --value <your-dsn> --visibility secret --scope project

eas-build-on-error — Sends an EASBuildError event to Sentry when a build fails. The event includes:

  • Build platform (ios / android)
  • Build profile (for example, production, preview)
  • Build ID, project ID, git commit hash
  • Whether the build ran on CI

eas-build-on-success — Optionally sends an info event when a build succeeds. Disabled by default; enable it with SENTRY_EAS_BUILD_CAPTURE_SUCCESS=true.

eas-build-on-complete — A single hook that captures either a failure or success event depending on the build outcome. Use this instead of on-error + on-success if you prefer a single hook entry point.

All events are tagged with eas.* tags so you can filter and group them in Sentry.

VariableRequiredDescription
SENTRY_DSNYesYour project's DSN
SENTRY_EAS_BUILD_CAPTURE_SUCCESSNoSet to true to capture successful builds
SENTRY_EAS_BUILD_TAGSNoJSON object of additional tags, for example {"team":"mobile"}
SENTRY_EAS_BUILD_ERROR_MESSAGENoCustom error message for failed builds
SENTRY_EAS_BUILD_SUCCESS_MESSAGENoCustom message for successful builds
SENTRY_RELEASENoOverride the release name (defaults to {appVersion}+{buildNumber})

The hook automatically loads environment variables from the following sources (without overwriting values already set by EAS):

  1. @expo/env (if available)
  2. .env file in the project root (via dotenv, if available)
  3. .env.sentry-build-plugin file in the project root

This means you can store the DSN in .env.sentry-build-plugin locally, and use an EAS secret in CI — the hook will use whichever value is already set.

If you only need to track failures but want the option to add success tracking later, eas-build-on-complete is the most flexible option. It reads EAS_BUILD_STATUS (set by EAS) to determine the outcome and captures the appropriate event:

package.json
Copied
{
  "scripts": {
    "eas-build-on-complete": "sentry-eas-build-on-complete"
  }
}

To also capture successful builds, set SENTRY_EAS_BUILD_CAPTURE_SUCCESS=true in your build environment.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").