firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.28k stars 579 forks source link

"Card model secondary action must be null or have a button" in-app campaign message crash with only primary button. #6543

Open sandsaber opened 2 days ago

sandsaber commented 2 days ago

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Getting plenty of crashes with Firebase in-app messaging when specify campaign which has only one primary button. image

Fatal Exception: io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.lang.IllegalArgumentException: Card model secondary action must be null or have a button
       at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
       at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
       at io.reactivex.internal.subscribers.LambdaSubscriber.onError(LambdaSubscriber.java:79)
       at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.checkTerminated(FlowableObserveOn.java:209)
       at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:399)
       at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176)
       at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:224)
       at android.os.Looper.loop(Looper.java:318)
       at android.app.ActivityThread.main(ActivityThread.java:8727)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Caused by java.lang.IllegalArgumentException: Card model secondary action must be null or have a button
       at com.google.firebase.inappmessaging.model.CardMessage$Builder.build(CardMessage.java:249)
       at com.google.firebase.inappmessaging.model.ProtoMarshallerClient.decode(ProtoMarshallerClient.java:231)
       at com.google.firebase.inappmessaging.internal.InAppMessageStreamManager.triggeredInAppMessage(InAppMessageStreamManager.java:370)
       at com.google.firebase.inappmessaging.internal.InAppMessageStreamManager.lambda$getTriggeredInAppMessageMaybe$27(InAppMessageStreamManager.java)
       at io.reactivex.internal.operators.maybe.MaybeFlatten$FlatMapMaybeObserver.onSuccess(MaybeFlatten.java:88)
       at io.reactivex.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onNext(FlowableElementAtMaybe.java:80)
       at io.reactivex.internal.operators.flowable.FlowableFlattenIterable$FlattenIterableSubscriber.drain(FlowableFlattenIterable.java:312)
       at io.reactivex.internal.operators.flowable.FlowableFlattenIterable$FlattenIterableSubscriber.onNext(FlowableFlattenIterable.java:174)

Steps to reproduce:

Issues happens randomly, but do happen. I was able to reproduce it only once per 10-30 test running via "Test on Device" Testing campaign (nothing special, it can be random "lorem"): image

  1. Create a campaign, fill the data, and have only one primary button.
  2. Press "test on device" and add the ID of the device which you want to test and send the test to this device.
  3. Reopen application on device to receive the campaign. (After the campaign show, press the primary button and fully close application). Repeat.
  4. Randomly, crash may appear when an application opened. (Approx in 10-20 test run, require patience to reproduce)

Relevant Code:

Seem like the same issues: https://github.com/firebase/firebase-android-sdk/issues/4625 https://github.com/firebase/firebase-android-sdk/issues/4048

Full log com.onoffapp.app_issue_ca44ad0ed195e57cfebb658c9c40e0d8_crash_session_6748C9FD01D20001457C39C575C2C5DD_DNE_1_v2_stacktrace.txt

google-oss-bot commented 2 days ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

lehcar09 commented 2 days ago

Hi @sandsaber, thank you for reaching out and reporting the issue. I tried reproducing the issue with the steps you shared, however, I wasn't able to encounter any crash. By any chance, can you share an MCVE to help us investigate the issue? If you're unable to provide one, can you try our quickstart app and see if you can reproduce the issue?

Aside from that, does the issue occur on certain devices and/or android versions? Thanks!