react-native-fingerprint-android icon indicating copy to clipboard operation
react-native-fingerprint-android copied to clipboard

java.lang.AssertionError · Tried to resolve the auth promise

Open mgoforth opened this issue 8 years ago • 1 comments

Hi,

First off, thanks for putting this plugin together it really saved me a lot of time with our new ReactNative project!

I'm currently seeing a few cases where the AssertionError is being thrown due to a null Promise in the AuthenticationCallback. I haven't been able to isolate the root cause, but it appears to be somewhat timing related with a cancel() being called.

On Authentication Succeeded:

java.lang.AssertionError Tried to resolve the auth promise, but it was already resolved / rejected. This shouldn't happen. 
    FingerprintModule.java:169 io.jari.fingerprint.FingerprintModule$AuthenticationCallback.onAuthenticationSucceeded
    FingerprintManagerCompat.java:301 android.support.v4.hardware.fingerprint.FingerprintManagerCompat$Api23FingerprintManagerCompatImpl$1.onAuthenticationSucceeded
    FingerprintManagerCompatApi23.java:114 android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23$1.onAuthenticationSucceeded
    FingerprintManager.java:1165 android.hardware.fingerprint.FingerprintManager$MyHandler.sendAuthenticatedSucceeded
    FingerprintManager.java:1096 android.hardware.fingerprint.FingerprintManager$MyHandler.handleMessage
    Handler.java:102 android.os.Handler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    ActivityThread.java:6688 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:1468 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:1358 com.android.internal.os.ZygoteInit.main

On Authentication Error:

java.lang.AssertionError Tried to reject the auth promise, but it was already resolved / rejected. This shouldn't happen. 
    FingerprintModule.java:147 io.jari.fingerprint.FingerprintModule$AuthenticationCallback.onAuthenticationError
    FingerprintManagerCompat.java:290 android.support.v4.hardware.fingerprint.FingerprintManagerCompat$Api23FingerprintManagerCompatImpl$1.onAuthenticationError
    FingerprintManagerCompatApi23.java:104 android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23$1.onAuthenticationError
    FingerprintManager.java:1136 android.hardware.fingerprint.FingerprintManager$MyHandler.sendErrorResult
    FingerprintManager.java:1102 android.hardware.fingerprint.FingerprintManager$MyHandler.handleMessage
    Handler.java:102 android.os.Handler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    ActivityThread.java:6688 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:1468 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:1358 com.android.internal.os.ZygoteInit.main

I know the Android Fingerprint documentation specifically mentions that after the onAuthenticationError callback executes no other callbacks should be called, but either that isn't true 100% of the time or there may be a currency issue of some kind. Regardless, would you consider downgrading the thrown AssertionError to log a warning instead? This would prevent a full application crash in these situations and shouldn't affect the existing JavaScript API since the Promise has already been resolved/rejected.

mgoforth avatar Oct 04 '17 16:10 mgoforth

This is now 'fixed' by logging to console instead of throwing an error (#20), I'm gonna leave this issue open though, as the underlying issue has not been fixed as of yet (which is it getting called multiple times in the first place)

jariz avatar May 04 '18 10:05 jariz