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

Android crash: Illegal callback invocation from native module #398

Closed
dnvarun opened this issue Jul 15, 2021 · 5 comments
Closed

Android crash: Illegal callback invocation from native module #398

dnvarun opened this issue Jul 15, 2021 · 5 comments
Assignees
Labels

Comments

@dnvarun
Copy link

dnvarun commented Jul 15, 2021

The problem

One of our android end users experienced a crash in the plaid flow caused by: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.

Environment

Plaid Link React Native 7.0.6
ReactNative Version 0.63.2
Occurs on Android yes
Android OS Version 10
Android Devices/Emulators TCL REVVL 4
Occurs on iOS N/A
iOS Version N/A
iOS Devices/Emulators N/A

Steps to Reproduce

N/A

Expected Result

No crash

Screenshots

N/A

Logs

Below is the relevant stack trace

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=3364, result=6148, data=Intent { (has extras) }} to activity {com.flyfinapp/com.flyfinapp.MainActivity}: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4873)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4914)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2041)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7386)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:982)

Caused by java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
       at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:26)
       at com.plaid.PlaidModule$onActivityResult$linkHandler$2.invoke(PlaidModule.kt:307)
       at com.plaid.PlaidModule$onActivityResult$linkHandler$2.invoke(PlaidModule.kt:29)
       at com.plaid.link.result.LinkResultHandler.onActivityResult(SourceFile:4)
       at com.plaid.PlaidModule.onActivityResult(PlaidModule.kt:311)
       at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:308)
       at com.facebook.react.ReactInstanceManager.onActivityResult(ReactInstanceManager.java:758)
       at com.facebook.react.ReactDelegate.onActivityResult(ReactDelegate.java:90)
       at com.facebook.react.ReactActivityDelegate.onActivityResult(ReactActivityDelegate.java:112)
       at com.facebook.react.ReactActivity.onActivityResult(ReactActivity.java:68)
       at android.app.Activity.dispatchActivityResult(Activity.java:8174)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4866)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4914)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2041)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7386)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:982)

Code To Reproduce Issue

N/A

@amytang0
Copy link
Contributor

amytang0 commented Aug 5, 2021

This can occur when people attempt to open Plaid Link multiple times. We are working on mitigating this on our end, but in the meantime, you can also disable the button after the first click and prevent multiple Plaid sessions from being opened.

@donatoaguirre24
Copy link

Hi @amytang0, how can we disable the button? I just checked the implementation but it seems the PlaidLink component does not support extra props like disabled because all the props are passed to openLink instead of TouchableOpacity

@atitpatel
Copy link

Have the same issue as @donatoaguirre24. Need a way to disable it.

@dnvarun
Copy link
Author

dnvarun commented Oct 15, 2021

@amytang0 We have found a point in our code where we might be calling openLink multiple times. But we have fixed it. Even then we are seeing this issue occasionally with our users.

@afh afh added the android label Jan 4, 2022
@mthahzan
Copy link

In our case, it was openLink being called more than once from a useEffect. After making sure it only get called once, the crash disappeared. Thanks @amytang0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants