Reputation: 141
Maybe I'm misunderstanding the purpose. I am looking for a solution to replace my console.log(errors) in my app as I get it ready for production. I went through the steps to add Sentry functionality to my expo managed work flow project. It seemed to work, it connects, it runs Sentry.init() just fine. But when I try to use Sentry.captureException('some exception') in place of a console.log, the app crashes and I get "Sentry.captureException is not a function". It logs THAT error in my sentry console. So the error is being passed to my sentry project. But from the documentation I'm following, Sentry.captureException should be a valid function? What am i missing? I have also tried Sentry.captureMessage with the same result.
App.js
import * as Sentry from 'sentry-expo';
Sentry.init({
dsn: 'xxxx',
enableInExpoDevelopment: true,
debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production.
});
enableScreens();
export default function App() {
return (
<NavigationContainer>
<AuthNavigator />
</NavigationContainer>
)
}
app.json expo hooks
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "myorganization",
"project": "myproject",
"authToken": "xxxx"
}
}
]
}
Upvotes: 1
Views: 10162
Reputation: 8038
You should use Sentry.Native.captureException('message')
- as per these docs.
Also note that sentry-expo
supports TypeScript, so if you were to use TypeScript for your project you would get autocompletion and an error when calling the wrong method.
Upvotes: 6