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

No JS-level errors sent in Release mode #700

Closed
3 of 6 tasks
matt-dalton opened this issue Oct 17, 2019 · 16 comments
Closed
3 of 6 tasks

No JS-level errors sent in Release mode #700

matt-dalton opened this issue Oct 17, 2019 · 16 comments

Comments

@matt-dalton
Copy link

OS:

  • Windows
  • [ x] MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native
  • react-native-sentry

react-native version: 0.60.6

Init Code:

Sentry.init({
    dsn: 'https://[email protected]/blah',
    ignoreErrors: [NetworkError.name],
    debug: true // just while I test
})

I have following issue:

Our React Native sentry installation no longer reports JS-level bugs. I'm now on react-native 0.60.6 & @sentry/react-native 1.0.9. I'm currrently testing on iOS but it hasn't been working on Android either. It hasn't been working for us for a while so don't think it's a new version issue.

I've tried removing and reinstalling the library.

When I run in dev mode, any error I throw appears in Sentry. But if I take the same code and run in release mode nothing gets sent. I can see the following in the logs in Xcode:

2019-10-17 13:25:14.309488+0100 [63272:2506227] Sentry Started -- Version: 4.4.0
2019-10-17 13:25:22.524 [error][tid:com.facebook.react.JavaScript] Sentry Logger [Error]: An event processor returned null, will not send event.

Steps to reproduce:

  • Install RN 0.60.6 & @sentry/react-native 1.0.9
  • Init the lib, then add throw new Error('test') on root App.js
  • Run the app in dev mode
  • It works! Bug appears in Sentry
  • Build the app in release mode (i.e. BuildConfiguration: Release)
  • Run the app.

Actual result:

  • No bug received in Sentry

Expected result:

  • Should be a bug report
@filipef101
Copy link
Contributor

Does using a older version fix this?

@matt-dalton
Copy link
Author

Is there any particular version I should try going back to? As I say, this hasn't worked for a while so not sure how far to go back

@AChevallier
Copy link

I have the same problem ! :(
I cannot say since when.

@jpolo
Copy link

jpolo commented Dec 6, 2019

Still reproducible on RN 0.61.5 + Sentry 1.1.0

@ghost
Copy link

ghost commented Dec 9, 2019

Any update on this? Facing same issue on "react-native": "0.61.4" "@sentry/react-native": "1.2.0"
Doesn't work for android release build. Works fine for iOS though.

@filipef101
Copy link
Contributor

It's dumb this is open for so long when there are paying customers affected by this

@matt-dalton
Copy link
Author

I managed to fix this after speaking to tech support. Achieved this by switching from ignoreErrors: [NetworkError.name] to a beforeSend function. I wrote something super simple like this:

const ignoredEventTypes: Array<string> = [NetworkError.name]

export default (event: Event) => {
    const eventType = get(event, 'exception.values[0].type')

    if (ignoredEventTypes.includes(eventType)) {
        // Not returning the event ignores it
        return
    }

    return event
}

For some reason, ignoreErrors was blocking anything

@HazAT
Copy link
Member

HazAT commented Jan 9, 2020

I am closing this since it seems to be solved.
The log Sentry Logger [Error]: An event processor returned null, will not send event. says that we discarded it because ignoreError matched it.
I am not sure if all ppl in this thread have exactly this problem?!

@HazAT HazAT closed this as completed Jan 9, 2020
@Aryk
Copy link

Aryk commented Aug 11, 2020

I managed to fix this after speaking to tech support. Achieved this by switching from ignoreErrors: [NetworkError.name] to a beforeSend function. I wrote something super simple like this:

const ignoredEventTypes: Array<string> = [NetworkError.name]

export default (event: Event) => {
    const eventType = get(event, 'exception.values[0].type')

    if (ignoredEventTypes.includes(eventType)) {
        // Not returning the event ignores it
        return
    }

    return event
}

For some reason, ignoreErrors was blocking anything

  1. What is "get" in your function? Can't seem to find it in sentry lib....
  2. Im getting the same error:

Screen Shot 2020-08-11 at 9 14 27 PM

Are you suggesting essentially not to use "ignoreErrors" and do basically do the ignoring in beforeSend, seems kind of hacky...but is what it is I guess...

@jennmueng
Copy link
Member

@Aryk Can I see what you have set for ignoreErrors?

@Aryk
Copy link

Aryk commented Aug 12, 2020

Sure ...here's the entire code:

Sentry.init({
  dsn: <hidden>,
  enableInExpoDevelopment: true,
  debug: true,
  environment: Constants.manifest.releaseChannel || "development",
  attachStacktrace: true,
  ignoreErrors: [
  "GraphQL Error (Code: 502)", // On development, get this weird intermittent message.
  "Background Location has not been configured. To enable it",
  "Network request failed",
  "Rendered fewer hooks than expected. This may be caused by",
  ],
});
// Keys are snake_case because this was the convention in the documentation.
Sentry.setTags({
  device_name: Constants.deviceName,
  ios_model: Constants.platform.ios?.model,
  ios_build_number: Constants.manifest.ios?.buildNumber,
  android_version_code: Constants.manifest.android?.versionCode,
  revision_id: Constants.manifest.revisionId,
  release_id: Constants.manifest.releaseId,
  version: Constants.manifest.version,
  // system_version: Constants.systemVersion.toString(),
});

@jennmueng
Copy link
Member

@Aryk So is the event being dropped an event that shouldn't be dropped I assume right? And can I see you have already set debug: true, can I have the logs?

@Aryk
Copy link

Aryk commented Aug 12, 2020

Sure...how do I get you the logs? I don't see it write to any log files in my directory. I can give you the console output, does that work?

@Aryk
Copy link

Aryk commented Aug 12, 2020

This is all I'm getting in my console:

Screen Shot 2020-08-12 at 6 02 29 PM

@jennmueng
Copy link
Member

@Aryk Hmm that looks correct, I see you have "Network request failed" in your ignoreErrors, it's being ignored thus the message. Also, the message is showing because you have debug: true set. If you disable debug the error won't be shown.

@Aryk
Copy link

Aryk commented Aug 12, 2020

Wow ok...I will turn debug off then. lol

Thanks for pointing that out...this error was driving me crazy

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

7 participants