Using Sentry with Expo

Expo is an excellent way to quickly create and play around with your React Native app. Now you can also use Sentry together with Expo:

Copied
npm i sentry-expo --save

In your main.js or app.js:

Copied
import Sentry from "sentry-expo";
// import { SentrySeverity, SentryLog } from 'react-native-sentry';
Sentry.config("https://examplePublicKey@o0.ingest.sentry.io/0").install();

Make sure to use your public DSN instead of the private one.

For uploading source maps you have to add this to your exp.json or app.json

Copied
{
  // ... 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"
        }
      }
    ]
  }
  // ...
}

Note that sentry-expo only catches JavaScript exceptions (as opposed to native crashes). For more details, take a look at the Expo documentation about native errors and this discussion in the sentry-expo repo.

If you need more help, check out Expo’s documentation about using Sentry.

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