For some reason, calling Sentry.init() is leading to a crash on load. In debug mode (in expo go) I get the following error, which seems completely unrelated:
Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}).
This error is in a hook provided by expo-fonts, not in one of my own hooks. Additionally, when I remove the code calling Sentry.init() (or set enableInExpoDevelopment: false, the error goes away and everything works normally. Of course this means that I can’t have Sentry in production which is a problem.
Does anyone know what could be causing this strange issue? I’ve double checked that my DSN and organization/project name are correct, and that I’ve followed the guide to a T.
Hi @wodin thanks for the response. It’s currently in another file that gets imported by App.tsx, but when I move it to the top of App.tsx I also get a strange error related to one of my hooks. It seems completely unrelated to Sentry, but the error disappears once I comment out Sentry.init(). It seems to have something to do with Suspense (I’m also using Jotai for state management).
Basically calling Sentry.init() is causing stateful hooks to bug out. I was able to improve the problem by removing an unnecessary <Suspense> component that I had, but it still hasn’t fixed the problem entirely.
I’m just not understanding how calling a synchronous function could possibly impact useState/state management hooks.
Actually, I forcefully fixed the other error I was having when calling Sentry.init() from App.tsx, now I’m getting the same error. Here’s a screenshot of it
Right, but the error is in FontHooks.js, which is in the expo-font package, not in my own code. And it stops when I comment out Sentry.init(). What could explain that? Why would calling Sentry.init cause an error inside expo-font?