flutter_stripe icon indicating copy to clipboard operation
flutter_stripe copied to clipboard

`lateinit property configuration has not been initialized` coming from `GooglePayLauncherFragment.java`

Open NunoOliveiraP opened this issue 2 years ago • 18 comments

Describe the bug We've been seeing a fair amount of Crashlytics error logs coming from what we imagine is one of the packages you rely on for this plugin.

There error is lateinit property configuration has not been initialized coming from GooglePayLauncherFragment.java:29. These errors seem to happen right at startup and likely after the app was launched from a notification interaction. We believe this is the case since the only local logs we can find before the error is thrown are session_start events from Firebase Analytics or the details of a background notification we just received (sometimes we see no logs at all).

All we have is the stacktrace and the information described above. Are you aware of anything that could be the cause for this?

To Reproduce We are not aware of how to reproduce this.

Expected behavior This error shouldn't happen since we have no interaction with any Stripe-related functionality or code at startup.

Smartphone / tablet

  • Device: Lots of Android phones (Samsung, Google, Oppo, Motorola, etc)
  • OS: All the way from Android 13 to Android 10
  • Package version: 9.2.0
  • Flutter version: 3.10.1

Additional context Stacktrace:

Fatal Exception: R9.B: lateinit property configuration has not been initialized
       at com.reactnativestripesdk.GooglePayLauncherFragment.onViewCreated(GooglePayLauncherFragment.java:29)
       at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:4)
       at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:6)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:3)
       at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:30)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:27)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:9)
       at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:11)
       at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:4)
       at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:20)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1510)
       at android.app.Activity.performStart(Activity.java:8616)
       at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4204)
       at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
       at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

NunoOliveiraP avatar Jun 15 '23 14:06 NunoOliveiraP

Hi @NunoOliveiraP, could you clarify it at any point you allow users to pay using the GooglePayButton?

It looks like the app looses the state at some point, the system restores the fragment automatically but we do not restore the local variables inside the fragment. I will create an issue in the Stripe React Native repository which whom we share the native layer

jamesblasco avatar Jun 17 '23 10:06 jamesblasco

Hi @NunoOliveiraP, could you clarify it at any point you allow users to pay using the GooglePayButton?

It looks like the app looses the state at some point, the system restores the fragment automatically but we do not restore the local variables inside the fragment. I will create an issue in the Stripe React Native repository which whom we share the native layer

Hi @jamesblasco, thanks for the reply! We do use the Google Pay button on one of our screens... Removing it won't be an option, but the error does not seem to affect the user experience as we haven't heard of any bugs from our users. It's mostly just a nuisance since it adds noise to our Crashlytics statistics and seems impossible to catch...

NunoOliveiraP avatar Jun 19 '23 13:06 NunoOliveiraP

Thanks @NunoOliveiraP, I have pointed to the official Stripe team to fix in in the respective repo. As soon as it is fixed there we will update it on our side

jamesblasco avatar Jun 19 '23 14:06 jamesblasco

We are seeing the exact same issue in crashlytics

emilysmithson avatar Nov 20 '23 10:11 emilysmithson

Is there any update on this issue? We have the same issue in Crashlytics.

ibrahimtelman avatar Mar 07 '24 10:03 ibrahimtelman

We are depending on the Stripe dev team to fix it. Until then there is nothing we can do.

remonh87 avatar Apr 14 '24 15:04 remonh87

@remonh87 @jamesblasco I have recreated by exiting the app while google pay is launching (what crazy users do this?!). Coming back to the app via the app switcher, google pay is presented over the app switcher, but everything dismisses straight away when google pay is dismissed. If there is a way we could stop google pay launching, we could call this when the app moves to the background? I had a look through the package but couldn't find a way to do this, would that be something you would consider adding? At the moment everything is behind the scenes after calling confirmPlatformPayPaymentIntent or confirmPlatformPaySetupIntent. Thanks!

DavidEcclesPH avatar Apr 22 '24 12:04 DavidEcclesPH