react-native-heap icon indicating copy to clipboard operation
react-native-heap copied to clipboard

Android crash tracking an object with an array.

Open nielsmadan opened this issue 5 years ago • 3 comments
trafficstars

When tracking an object that includes an array as property, on Android we are seeing a crash.

Error is:

Property objects must be flattened before being sent across the JS bridge.
convertToStringMap
    RNHeapLibraryModule.java:81
manuallyTrackEvent
    RNHeapLibraryModule.java:114
invoke
    Method.java
invoke
    JavaMethodWrapper.java:372
invoke
    JavaModuleWrapper.java:158
run
    NativeRunnable.java
handleCallback
    Handler.java:789
dispatchMessage
    Handler.java:98
dispatchMessage
    MessageQueueThreadHandler.java:29
loop
    Looper.java:164
run
    MessageQueueThreadImpl.java:232
run
    Thread.java:764

Removing the array property fixes the problem.

Version is 0.10.0. React Native version is 0.59.10.

nielsmadan avatar Feb 15 '20 15:02 nielsmadan

Thanks for the report! Heap doesn't support non-scalar property values at present, so the likely fix here is going to be to throw an exception on the JS side with a more meaningful error message. My suggestion is to flatten the array, eg via array.join(',').

kamalmarhubi avatar Feb 16 '20 03:02 kamalmarhubi

Maybe mention it in the docs somewhere? Or is it already there and I missed it?

nielsmadan avatar Feb 16 '20 10:02 nielsmadan

Could the Heap library fail gracefully instead of crashing the app when this happens?

tribou avatar Dec 12 '23 16:12 tribou