GoogleCloudPlatform / recaptcha-enterprise-react-native

Apache License 2.0
28 stars 4 forks source link

SDK not being initialised after 3 tries #17

Closed LouisKraemer closed 6 months ago

LouisKraemer commented 11 months ago

Hi, we installed this SDK in our RN app but some user are reporting failure and we can see from the logs that the SDK is not being initialised correctly.

What we tried

Unfortunately we still encounter that issue.

Versions

Please let me know if I need to provide additionnal details to help you fix this issue.

mcorner commented 11 months ago

Do you have logs of the exceptions and what rate they occur?

LouisKraemer commented 11 months ago

Around 2% of our user base is having this issue.

In terms of logs, the SDK is no throwing any errors. We are manually putting a timeout to avoid it waiting forever.

We do use the second argument of the initClient to put a timeout but it seems to not be taken into account

LouisKraemer commented 11 months ago

I did find those logs just now {"nativeStackAndroid":[{"lineNumber":2,"file":"com.google.android.recaptcha:recaptcha@@18.3.0","methodName":"zzs","class":"com.google.android.recaptcha.internal.zzdm"},{"lineNumber":12,"file":"com.google.android.recaptcha:recaptcha@@18.3.0","methodName":"zzh","class":"com.google.android.recaptcha.internal.zzdm"},{"lineNumber":14,"file":null,"methodName":"invokeSuspend","class":"com.google.android.recaptcha.internal.zzdh"},{"lineNumber":33,"file":"ContinuationImpl.kt","methodName":"resumeWith","class":"kotlin.coroutines.jvm.internal.BaseContinuationImpl"},{"lineNumber":32,"file":"Scopes.kt","methodName":"afterResume","class":"kotlinx.coroutines.internal.ScopeCoroutine"},{"lineNumber":102,"file":"AbstractCoroutine.kt","methodName":"resumeWith","class":"kotlinx.coroutines.AbstractCoroutine"},{"lineNumber":46,"file":"ContinuationImpl.kt","methodName":"resumeWith","class":"kotlin.coroutines.jvm.internal.BaseContinuationImpl"},{"lineNumber":106,"file":"DispatchedTask.kt","methodName":"run","class":"kotlinx.coroutines.DispatchedTask"},{"lineNumber":958,"file":"Handler.java","methodName":"handleCallback","class":"android.os.Handler"},{"lineNumber":99,"file":"Handler.java","methodName":"dispatchMessage","class":"android.os.Handler"},{"lineNumber":205,"file":"Looper.java","methodName":"loopOnce","class":"android.os.Looper"},{"lineNumber":294,"file":"Looper.java","methodName":"loop","class":"android.os.Looper"},{"lineNumber":8177,"file":"ActivityThread.java","methodName":"main","class":"android.app.ActivityThread"},{"lineNumber":-2,"file":"Method.java","methodName":"invoke","class":"java.lang.reflect.Method"},{"lineNumber":552,"file":"RuntimeInit.java","methodName":"run","class":"com.android.internal.os.RuntimeInit$MethodAndArgsCaller"},{"lineNumber":971,"file":"ZygoteInit.java","methodName":"main","class":"com.android.internal.os.ZygoteInit"}],"userInfo":null,"message":"Internal Error","code":"EUNSPECIFIED"},""]

Also noted that sometime we have basically the same log but with Network Error

mcorner commented 11 months ago

Sorry for the delay. Let's see if we can tackle this one bit at a time:

Also noted that sometime we have basically the same log but with Network Error

This is exactly what it says it is, the SDK couldn't contact our server over the network or the network was too slow. We are working to decrease the network requirements of the SDK, but that is a longer term project.

{"lineNumber":2,"file":"com.google.android.recaptcha:recaptcha@@18.3.0","methodName":"zzs","class":"com.google.android.recaptcha.internal.zzdm"},

Are you confident that this is init and not execute? We have a pretty good idea what is going on here and will be improving this over the next month

LouisKraemer commented 10 months ago

Sorry for the delay. Let's see if we can tackle this one bit at a time:

Also noted that sometime we have basically the same log but with Network Error

This is exactly what it says it is, the SDK couldn't contact our server over the network or the network was too slow. We are working to decrease the network requirements of the SDK, but that is a longer term project.

{"lineNumber":2,"file":"com.google.android.recaptcha:recaptcha@@18.3.0","methodName":"zzs","class":"com.google.android.recaptcha.internal.zzdm"},

Are you confident that this is init and not execute? We have a pretty good idea what is going on here and will be improving this over the next month

I'd need to get back to that specific issue to confirm. We still have a lot of users with issues about SDK initialisation though

LouisKraemer commented 10 months ago

@mcorner Regarding the work you're doing to improve network requirements, is there anything I can do to help (debug, test)?

mcorner commented 10 months ago

Yes, of course, always looking for feedback and data. Let's start with upgrading the SDK to 18.4.0 (came out yesterday). This may or may not improve things for you, but will definitely provide us more internal telemetry to pinpoint the issue. Once you do that, you can give me your sitekey to look at the results (here or by emailing me at my first and last name at google.com).

You should also log any exceptions yourself and we can compare numbers.

The react native code currently doesn't contain any retry loop. We did provide this as sample code for native here: https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk/tree/main/examples

There will also be another version of the SDK sometime around Feb that lowers the networking needs, but let's see what 18.4.0 is telling us.

LouisKraemer commented 9 months ago

Sorry for the long wait, we had other focus + holidays

Just upgraded the SDk to 18.4.0, we still need to do a production release to monitor the success rate of this SDK. When it comes to the retry loop, we implemented our own but when it fails on the first try, it always fails on the second.

mcorner commented 9 months ago

@LouisKraemer let me know how it goes . We have seen significant improvements in 18.4.0. If you have the bandwidth to try a private beta build of the SDK (would be a local file and not.gmaven), let me know at my first name plus my last name at google. Send me your site key and app name.

LouisKraemer commented 8 months ago

@mcorner We're pushing 18.4.0 on Monday and we're gonna monitor how it goes. If we're still having issues, I'll see if I can prioritise integrating the beta build.

Thanks

mcorner commented 8 months ago

Ok. We are tracking one issue in 18.4 https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk/issues/84 that might require a patch (18.4.1). We will update here

mcorner commented 6 months ago

Since we haven't heard back on this issue we will close it now .