GoogleCloudPlatform / recaptcha-enterprise-flutter

Apache License 2.0
23 stars 8 forks source link

initClient throwing PlatformException on iOS #21

Closed brunovsiqueira closed 1 year ago

brunovsiqueira commented 1 year ago

Hello there,

We have just released our app to production with the integration of Recaptcha Enterprise using this library. We want to express our gratitude for providing official support for this integration.

While the app works smoothly on Android, we have encountered some error logs on iOS. The errors appear as two different PlatformException instances on the iOS side:

  1. PlatformException(1, Network Error., null, null)
  2. PlatformException(100, Internal Error., null, null)

Here's the stack trace for these exceptions:

#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310)
<asynchronous suspension>
#2      MethodChannelRecaptchaEnterprise.initClient (package:recaptcha_enterprise_flutter/recaptcha_enterprise_method_channel.dart:34)
<asynchronous suspension>

We want to know if these exceptions are expected, and whether we should handle them. If so, we believe it would be helpful if they could be mapped to specific exceptions on the Flutter side. This way, it would be easier for us to handle them appropriately.

Out of the two exceptions, the one that concerns us the most is the "Internal Error." We've observed that only one user has encountered this error, while all others have received the "Network Error." What does "Internal error" exactly means?

Thanks in advance for your attention.

mcorner commented 1 year ago

Network errors are as they sound, the SDK was unable to fetch some of its resources in time or contact the server.

The internal error is typically due to the SDK timing out internally. We are working to eliminate the remaining causes of this error, but they should be relatively rare. It sounds like that is the case if it is "one user" (I presume that is a small percentage!). So, yes, a bug, and we are working on it.

In both cases the best approach is to retry, but the SDK does depend on having a network connection to work.