Using Sentry with Expo
Note
This SDK has been superseded by the new React Native SDK. Sentry preserves this documentation for customers using the old client. We recommend using the updated React Native SDK for new projects.
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:
npm i sentry-expo --save
In your main.js
or app.js
:
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
{
// ... 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.