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

Sentry is not sending global errors #23

Closed
mfru opened this issue Feb 17, 2018 · 9 comments
Closed

Sentry is not sending global errors #23

mfru opened this issue Feb 17, 2018 · 9 comments

Comments

@mfru
Copy link

mfru commented Feb 17, 2018

So I have tried to install Sentry as specified in the Expo section for Sentry / Sentry section for Expo.

My App.js contains the Sentry import, I enabled it in development and called Sentry.config(<MyPublicDSN>).install().

When trying to throw a test error like so: throw new Error("TestError), Sentry does not pick up on it, even though the application crashes as expected.

However, using Sentry.captureException(new Error("TestError") yields the expected results.

Am I missing something?

EDIT: I also tried reloading the app (as it is stated that errors will get reported on next startup) a few times in the meantime, but it is not sending then either.

@mfru mfru closed this as completed Mar 15, 2018
@saleemjaffer
Copy link

@mfru You have closed this issue. Is the issue solved?

@mfru
Copy link
Author

mfru commented Mar 29, 2018

I don't know if it is my fault or sentry-expos, but when running in prod mode, Errors get indeed reported while in dev mode it seems to not report everything (some errors yes, some not).

I closed the issue, because it kind of is resolved for me.

@saleemjaffer
Copy link

@mfru Thanks.

@andresespinosapc
Copy link

andresespinosapc commented May 24, 2018

I'm having the same problem but it is not working even on production. I have tried using Sentry.config('DSN', { logLevel: 3 }).install() with logLevel to have more information of the Raven process, but it doesn't log anything when I throw an error, it only logs if I run explicitly Sentry.captureException.

@freeall
Copy link

freeall commented Jun 19, 2018

I get the same. I only see errors in production if I explicitly call Sentry.captureException.

@andresespinosapc
Copy link

In my case, the problem was because of using a different entry point than the expo’s default. I imported an index.js from App.js. Moving the index.js content to App.js solved the problem.

@freeall
Copy link

freeall commented Jun 20, 2018

It took a while, but in my case the error (that I was testing with) happened in componentDidMount where the error seemed to be swallowed by react-navigation since it was initialized in a navigation.navigate.

In the end I've done this in my App.js to capture errors. Leaving it here in case this may help others:

import React from 'react';
import { Provider } from 'react-redux';
import store from './lib/createStore';
import Root from './containers/Root';
import Sentry from 'sentry-expo';

// Sentry.enableInExpoDevelopment = true
Sentry.config('https://[email protected]/...').install();

export default () => (
  <Provider store={store}>
    <ErrorBoundary>
      <Root />
    </ErrorBoundary>
  </Provider>
);

// This is a way to handle all errors in the app.
class ErrorBoundary extends React.Component {
  componentDidCatch (error, errorInfo) {
    Sentry.captureException(error, {
      extra: errorInfo
    });
  }

  render () {
    const { children } = this.props;
    return children;
  }
}

@summerkiflain
Copy link

summerkiflain commented Jul 18, 2019

Using above method and Sentry.enableInExpoDevelopment = true, I am able to log errors from local env, but its not working for me in production, i have published my changes and using sentry-expo v1.13.0. EDIT: its working in iOS simulator but not using android devices.

@AdamGerthel
Copy link

AdamGerthel commented Jan 4, 2020

Same problem for me - I'm initiating Sentry in App.js right after module imports, and it still never catches fatal errors, only those that I explicitly call using Sentry.captureException are sent to Sentry.

Update: Seems like debug: true is required for Sentry to catch fatal errors.

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

6 participants