SDK API Reference

Using Sentry

Sentry is a crash reporting and aggregation platform that provides you with “real-time insight into production deployments with info to reproduce and fix crashes”.

It notifies you of exceptions that your users run into while using your app and organizes for you to triage from their web dashboard. Reported exceptions include sourcemapped stacktraces and other relevant context (device id, platform, Expo verison, etc.) automatically; you can also provide other context that is specific to your application, like the current route and user id.

Why Sentry?

  • Sentry treats React Native is a first-class citizen and we have collaborated with Sentry to make sure Expo is too.

  • It’s easy to set up and use.

  • It scales to meet the demands of the even the largest projects.

  • It works on most platforms, so you can use the same service for reporting your server, CLI, or desktop app errors as you use for your Expo app.

  • We trust it for our projects at Expo.

  • It is free for up to 10,000 events per month.

Add Sentry to your Expo project

Sign up for a Sentry account and create a project

  • Sign up for a Sentry account

  • Once you have signed up, you will be prompted to create a project. Enter the name of your project and continue.

  • Go to the Sentry API section and create an auth token. You can use the default configuration, this token will never be made available to users of your app. Copy your auth token and save it for later.

  • Go to your project dashboard by going to and clicking “Select a project” from the top of the screen, then choosing your project. This is where you will see exceptions reported later. For now, click “Project Settings” in the top right, and copy your project “Short name” as well as your team short name. The team short name is the name in parentheses, eg: “brents-sentry-example” in “Brent’s Sentry Example (brents-sentry-example)“.

Install and configure Sentry

  • Make sure you’re using a new version of Node which supports async/await (Node 7.6+)

  • Install the Sentry CLI globally: npm i sentry-cli-binary --global

  • In your project, install the Expo integration: npm i sentry-expo --save

  • Add the following in your app entry file (main.js by default).

import Sentry from 'sentry-expo';
Sentry.config('your Public DSN goes here').install();
  • Open exp.json and add a postPublish hook:

  // ... your existing exp.json configuration is here

  "hooks": {
    "postPublish": [
        "file": "sentry-expo/upload-sourcemaps",
        "config": {
          "organization": "your team short name here",
          "project": "your project short name here",
          "authToken": "your auth token here"

Publish your app with sourcemaps

With the postPublish hook in place, now all you need to do is hit publish and the sourcemaps will be uploaded automatically. We automatically assign a unique release version for Sentry each time you hit publish, based on the version you specify in exp.json and a release id on our backend — this means that if you forget to update the version but hit publish, you will still get a unique Sentry release. If you’re not familiar with publishing on Expo, you can read more about it here.

Error reporting semantics

In order to ensure that errors are reported reliably, Sentry defers reporting the data to their backend until the next time you load the app after a fatal error rather than trying to report it upon catching the exception. It saves the stacktrace and other metadata to AsyncStorage and sends it immediately when the app starts.

Learn more about Sentry

Sentry does more than just catch fatal errors, learn more about how to use Sentry from their JavaScript usage docs.