jariz / jariz/react-native-fingerprint-android

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

Open
#19 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
96
Forks
31
PR merge metrics
No merged PRs in 30d

Description

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](https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager.AuthenticationCallback.html#onAuthenticationError(int,java.lang.CharSequence)) 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in FingerprintModule.java at the AuthenticationCallback handlers around lines 147 and 169, then trace how cancel() affects the auth Promise. Reproduce the succeeded and error callback cases described in the issue and verify that repeated callbacks no longer crash the application while the existing JavaScript Promise behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, react-native
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.