Once again, my bad, the source was right but not yet released, version 2.0.0 of sentry-expo does not send the releaseId to the Sentry init, therefore the code from docs is required in the meantime,
This is what the code looks like in version 2.0.0:
sentry is working now for me with sources.
i had a wrong import statement.
old:
import * as Sentry from "@sentry/react-native";
new: import * as Sentry from 'sentry-expo';
and also setting the release: Sentry.setRelease(Constants.manifest.revisionId);
what still is not working is the redux integration.
switching from expo32 to expo35 i changed from raven-for-redux to redux-sentry-middleware
but the redux-state and redux-lastAction donât show up in sentry.
Were you able to get your implementation working with web?
Iâm using Expo SDK 35, Sentry Expo 2.0.1 and getting the following like you did.
Module parse failed: Unexpected token (25:12)
You may need an appropriate loader to handle this file type.
|
| class ExpoIntegration {
> static id = 'ExpoIntegration';
| name = ExpoIntegration.id;
I was not able to get it to work. Iâm still thinking that itâs something Babel-related that might fix it, but after some trial and error I made no progress and had to shelve it.
sentry-expo doesnât support web just yet, it is something we want to get to eventually. In the meantime, weâre always open to PRs to the repo to get it working
to my babel.config.js file, but it still throws the error. Do you know if I also have to add anything to webpack.config.js to respect the addition to the babel config?
FYI: As a workaround until we come up with a consolidated native+web sentry-expo, Iâm using .native and .web config files to import and initialize either sentry-expo for the native packages or â@sentry/browserâ for the web build of my app. In addition to giving me working error tracking on the web, I can also track git commits with my releases (something I donât get from sentry-expo).
Has anyone gotten Expo web to compile while having Sentry installed? Iâm happy to not use Sentry on the web for now, but I canât even get my web project to compile (âYou may need an appropriate loaderâŚâ error above) because Sentry is installed ("sentry-expo@2.0.1).
@apoyando Could you explain your solution further if it does this? Thanks
More generally, it seems like this happens quite frequently. Another package thatâs cause it for me currently is rn-sliding-up-panel. It would be nice if there were a way to make all these issues go away. I also tried getting â[â@babel/plugin-proposal-class-propertiesâ, { loose: true }],â but couldnât get it to work.
EDIT: Downgrading to Sentry 1.13.0 seems to fix the issue for now.
@vjsingh, hereâs a simplified version of what I did to sidestep the sentry-expo web incompatibility:
I created two files: sentry.native.js and sentry.web.js
In sentry.native.js, I import and initialize sentry from âsentry-expoâ just as the Expo docs specify, then export the Sentry object.
In sentry.web.js, I import and initialize sentry from â@sentry/browserâ (which I installed) as specified in the sentry standard JS documentation (itâs very similar, but thereâs no âenableInExpoDevelopmentâ). I also export the Sentry object from this file.
In my App.js, I import Sentry from â./sentryâ. Now when I build the native files, Expo will import from âsentry.native.jsâ. When I build the web files, Iâll be importing from âsentry.web.jsâ.
Thatâs hopefully enough just to get things working. In my case, I added an error boundary and am also reporting separate releases to Sentry for my web app at publish time.
@apoyando Thanks thatâs a good explanation. And a clever trick about the â.native.jsâ and â.web.jsâ I didnât realize Expo would do that automatically.
Iâm a little confused though since Iâm not even attempting to use Sentry in my web project at all. I believe it doesnât require Sentry in any way, so Iâm not sure why itâs causing the compile time error. If itâs working for you then perhaps I set up my project in the wrong way somehow.
@vjsingh I think if youâre importing and initializing Sentry from âsentry-expoâ anywhere in your app, youâre going to run into a problem when doing the web build. Are you doing it in App.js?