Some Sentry methods don't work with Expo

#1

I have Sentry setup with the following:

import Sentry from 'sentry-expo';
import { SENTRY_DSN } from 'react-native-dotenv';

Sentry.enableInExpoDevelopment = true;
Sentry.config(SENTRY_DSN).install();

I am trying to throw an exception and then get the event id of that exception. The docs mention how to do this, and I implemented it like so:

Sentry.captureException(new Error('Broken!'));
console.log(Sentry.lastException()) // null
console.log(Sentry.lastEventId()) // null

Unfortunately, both lastException and lastEventId are returning null for some reason. The error is definitely being sent to Sentry as you can see from the screenshot below, so I’m not sure why this is happening.

Why are some Sentry methods not working? Is it necessary to eject to ExpoKit if I want to use Sentry properly?

closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.