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

Crash inside RNSentryModule#captureEvent on Android #353

Closed
2 of 5 tasks
mickamy opened this issue Feb 14, 2018 · 0 comments
Closed
2 of 5 tasks

Crash inside RNSentryModule#captureEvent on Android #353

mickamy opened this issue Feb 14, 2018 · 0 comments
Assignees

Comments

@mickamy
Copy link

mickamy commented Feb 14, 2018

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

$ node -v && npm -v && npm ls --prod --depth=0
v8.5.0
5.3.0
├── @ptomasroos/[email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected] invalid
├── [email protected] invalid
├── [email protected] invalid
├── [email protected] invalid
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

npm ERR! peer dep missing: react@>=15.3.1, required by [email protected]
npm ERR! peer dep missing: react@^0.13.0 || ^0.14.0 || ^15.0.0 || ^16.0.0, required by [email protected]
npm ERR! invalid: @ptomasroos/[email protected] /Users/mikami/WA/mobile_app/node_modules/@ptomasroos/react-native-multi-slider
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-google-signin
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-looped-carousel
npm ERR! extraneous: [email protected] /Users/mikami/WA/mobile_app/node_modules/lodash.isequal
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-material-dropdown
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-material-dropdown/node_modules/react-native-material-textfield
npm ERR! extraneous: [email protected] /Users/mikami/WA/mobile_app/node_modules/color
npm ERR! extraneous: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-material-buttons
npm ERR! extraneous: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-material-ripple
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-material-textfield
npm ERR! extraneous: [email protected] /Users/mikami/WA/mobile_app/node_modules/color
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-mixpanel
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-parsed-text
npm ERR! invalid: [email protected] /Users/mikami/WA/mobile_app/node_modules/react-native-permissions

Config:

Sentry.config('https://[email protected]/...', {
    deactivateStacktraceMerging: true, // disable stacktrace merging for it causes error somehow.
}).install()

I have following issue:

Some JS error causes NoSuchKeyException.
I don't know what is it like (sorry, I could not reproduce it).
Here's a Java stacktrace we have on Sentry.

com.facebook.react.bridge.NoSuchKeyException: couldn't find key value in dynamic object
    at com.facebook.react.bridge.ReadableNativeMap.getString(ReadableNativeMap.java)
    at io.sentry.RNSentryModule.captureEvent(RNSentryModule.java:251)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
    at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
    at android.os.Looper.loop(Looper.java:180)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
    at java.lang.Thread.run(Thread.java:764)

screenshot_20180214-143539

Steps to reproduce:

  • Sorry, I don't know how to reproduce it.
  • I guess some JS error does not satisfy RN-sentry's assumptions.

Actual result:

From line 248 in RNModule.java, I rewrite to below.

        if (event.hasKey("exception")) {
            ReadableNativeArray exceptionValues = (ReadableNativeArray)event.getMap("exception").getArray("values");
            ReadableNativeMap exception = exceptionValues.getMap(0);
            ReadableNativeMap stacktrace = exception.getMap("stacktrace");
            if (exception.hasKey("type") && exception.hasKey("value") && stacktrace.hasKey("frames")) {
                addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("frames"));
            } else {
                try {
                    Log.e("RNSentryDebug", "InvalidExceptionMap: event=" + MapUtil.toJSONObject(event).toString());
                    Log.e("RNSentryDebug", "InvalidExceptionMap: exception=" + exception);
                    Log.e("RNSentryDebug", "InvalidExceptionMap: stacktrace=" + stacktrace);
                } catch (JSONException e) {
                    Log.e("RNSentryDebug", "InvalidExceptionMap: event=" + event.toString());
                    Log.e("RNSentryDebug", "InvalidExceptionMap: exception=" + exception);
                    Log.e("RNSentryDebug", "InvalidExceptionMap: stacktrace=" + stacktrace);
                }
                throw new Error("hoge");
            }
        }

And I got...

02-14 15:26:21.191 21231 21323 E RNSentryDebug: InvalidExceptionMap: event={"project":"244252","type":"Unhandled Promise Rejection","platform":"javascript","event_id":"98280c2a9fdf4066bc6b943748a05505","request":{},"user":{},"timestamp":1.518589580831E9,"exception":{"values":[{"stacktrace":{"frames":[{"in_app":true,"function":"callFunctionReturnFlushedQueue","colno":32,"lineno":1876,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"flushedQueue","colno":20,"lineno":1897,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__guard","colno":11,"lineno":2028,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":31,"lineno":1898,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__callImmediates","colno":30,"lineno":2042,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"callImmediates","colno":31,"lineno":12893,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callImmediatesPass","colno":17,"lineno":12689,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callTimer","colno":15,"lineno":12653,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":24,"lineno":12759,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":25,"lineno":11528,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"tryCallOne","colno":14,"lineno":11442,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":40,"lineno":115799,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ClientError","colno":116,"lineno":98855,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ExtendableError","colno":23,"lineno":98603,"filename":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false"}]},"type":"ClientError"}]},"culprit":"app:\/\/\/index.bundle?platform=android&dev=true&minify=false","logger":"javascript","tags":{"environment":"development"},"extra":{"session:duration":10576}}
02-14 15:26:21.193 21231 21323 E RNSentryDebug: InvalidExceptionMap: exception={ NativeMap: {"stacktrace":{"frames":[{"in_app":true,"function":"callFunctionReturnFlushedQueue","colno":32,"lineno":1876,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"flushedQueue","colno":20,"lineno":1897,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__guard","colno":11,"lineno":2028,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":31,"lineno":1898,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__callImmediates","colno":30,"lineno":2042,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"callImmediates","colno":31,"lineno":12893,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callImmediatesPass","colno":17,"lineno":12689,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callTimer","colno":15,"lineno":12653,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":24,"lineno":12759,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":25,"lineno":11528,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"tryCallOne","colno":14,"lineno":11442,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":40,"lineno":115799,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ClientError","colno":116,"lineno":98855,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ExtendableError","colno":23,"lineno":98603,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"}]},"type":"ClientError"} }
02-14 15:26:21.193 21231 21323 E RNSentryDebug: InvalidExceptionMap: stacktrace={ NativeMap: {"frames":[{"in_app":true,"function":"callFunctionReturnFlushedQueue","colno":32,"lineno":1876,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"flushedQueue","colno":20,"lineno":1897,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__guard","colno":11,"lineno":2028,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":31,"lineno":1898,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"__callImmediates","colno":30,"lineno":2042,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"callImmediates","colno":31,"lineno":12893,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callImmediatesPass","colno":17,"lineno":12689,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"_callTimer","colno":15,"lineno":12653,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":24,"lineno":12759,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":25,"lineno":11528,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"tryCallOne","colno":14,"lineno":11442,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"?","colno":40,"lineno":115799,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ClientError","colno":116,"lineno":98855,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"},{"in_app":true,"function":"ExtendableError","colno":23,"lineno":98603,"filename":"app:///index.bundle?platform=android&dev=true&minify=false"}]} }

Expected result:

  • Error should be reported to Sentry successfully.
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

2 participants