Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing Sentry causes error dealing with fetch. #31

Closed
AndrewSouthpaw opened this issue Jun 13, 2018 · 4 comments
Closed

Importing Sentry causes error dealing with fetch. #31

AndrewSouthpaw opened this issue Jun 13, 2018 · 4 comments

Comments

@AndrewSouthpaw
Copy link

AndrewSouthpaw commented Jun 13, 2018

Adding import Sentry from 'sentry-expo' to my App.js causes my app to crash:

Unhandled JS Exception: Requiring module "fetch", which threw an exception. 
TypeError: undefined is not an object (evaluating 'self.fetch').

Digging around, I've seen issues crop up in react-native here and fetch here and isomorphic-fetch here. AFAICT, isomorphic-fetch is the root of the problem, it's not maintained and didn't support React Native, and now people are moving to other packages (cross-fetch, fetch-everywhere, fetch-ponyfill, etc.) as a replacement.

Are other people running into this problem? Right now, following the Expo docs, I'm unable to get Sentry to work for React Native. 😞

Versions:

"expo": "^27.0.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
"sentry-expo": "^1.9.0"
@mxstbr
Copy link

mxstbr commented Jun 21, 2018

✋ We're also running into this exact same error! Interestingly, it did work in SDK 27 but as soon as we try upgrading to SDK 28 this red screen error pops up on boot. withspectrum/spectrum#3372

@brentvatne
Copy link
Member

brentvatne commented Jun 21, 2018

hey @AndrewSouthpaw I cannot repro this in a branch new app. I created a new app and added sentry-expo and it worked as expected. Perhaps another package that you and @mxstbr have in your apps is causing an unexpected interaction?

@AndrewSouthpaw
Copy link
Author

FYI we resolved the issue by changing our .babelrc file. It used to contain a bunch of stuff:

presets: ['es2015', 'react', 'stage-2', 'flow', 'babel-preset-expo']

We changed it to

presets: ['babel-preset-expo']

and the problem resolved itself.

@brentvatne
Copy link
Member

@mxstbr ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants