IDEMSInternational / open-app-builder

PLH App Frontend
GNU General Public License v3.0
6 stars 25 forks source link

[Crashlytics] Error: Must provide notifications array as notifications option #1827

Open esmeetewinkel opened 1 year ago

esmeetewinkel commented 1 year ago

Crashlytics Link WASH PLH TZ

GlitchTip Link plh_global wash plh_tz

Report txt

Non-fatal Exception: com.getcapacitor.community.firebasecrashlytics.JavaScriptException
Uncaught (in promise): Error: Must provide notifications array as notifications option 
Error: Must provide notifications array as notifications option at returnResult (http://localhost/:747:32) 
at win.androidBridge.onmessage (http://localhost/:722:21)

Diagnosis (if known)

Suggested fix (if known) recommended means to fix

jfmcquade commented 1 year ago

Besides identifying that this is an error thrown by Capacitor's local notification plugin, I'm not sure how to determine the cause of the problem. Perhaps we could discuss this in our next meeting.

Looking at the glitchtip events for plh_global, the logs are from the debug builds I was making to test PR #1803. The Pixel 5 is mine and I assume the OnePlus8Pro is @chrismclarke ? On that PR, I've now updated the error logging dsn for the plh_debug deployment, so the logs should be sent to the correct project.

Screenshot 2023-03-07 at 11 20 55 Screenshot 2023-03-07 at 11 20 31
chrismclarke commented 1 year ago

The sourcemaps don't seem to be working quite as intended (attempting fix in #1834), but looking at the error message itself and capacitor seems simply that at some point when scheduling notificaitons we aren't passing valid data.

In the capacitor codebase I can see two places where the error is thrown:

  1. https://github.dev/ionic-team/capacitor-plugins/blob/main/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotification.java#L212

  2. https://github.dev/ionic-team/capacitor-plugins/blob/main/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotification.java#L293

The first case looks to be if the notification list is null, the second null or empty. I don't expect either to be too serious (fine to not further process notifications when list null or empty), but if we want to avoid the error likely just a case of adding an extra check/fallback when we call LocalNotifications.schedule in our codebase to only called if the corresponding notification list is a non-zero length array.

esmeetewinkel commented 1 year ago

Issue re-appeared on Firebase on v0.16.17 of ParentApp TZ

jfmcquade commented 1 year ago

Issue re-appeared on Firebase on v0.16.17 of ParentApp TZ

It looks to me like Firebase crashlytics seems to be grouping some issues together that are not the same.

The first error at that link is the following:

Non-fatal Exception: com.getcapacitor.community.firebasecrashlytics.JavaScriptException: Uncaught (in promise): Error: 12501: 
Error: 12501: 
    at returnResult (http://localhost/:747:32)
    at win.androidBridge.onmessage (http://localhost/:722:21)
       at .returnResult(:747)
       at .win.androidBridge.onmessage(:722)
       at .re(polyfills.e91c1101d08ae204.js:1)
       at .(anonymous function)(polyfills.e91c1101d08ae204.js:1)
       at .(anonymous function)(polyfills.e91c1101d08ae204.js:1)
       at .Ve(main.8bdfdf9faf11d6d6.js:1)
       at .C.invoke(polyfills.e91c1101d08ae204.js:1)
       at .Object.onInvoke(main.8bdfdf9faf11d6d6.js:1)
       at .C.invoke(polyfills.e91c1101d08ae204.js:1)
       at .C.run(polyfills.e91c1101d08ae204.js:1)
       at .(anonymous function)(polyfills.e91c1101d08ae204.js:1)
       at .C.invokeTask(polyfills.e91c1101d08ae204.js:1)

This is mirrored in glitchtip here. It looks this may be a bug with the plugin we use for Google authentication, where the error may be thrown simply by the user dismissing the sign-in prompt.

The other issues logged to crashlytics at the above link do seem to be a return of the current issue (1827) relating to notifications, that should have been fixed by #1851. However, searching Glitchtip I can't find the equivalent errors logged there. I think further investigation is needed, I'll come back to this.

chrismclarke commented 1 year ago

You're right @jfmcquade - seems like the issues are getting grouped.

For the auth issue, I can in a few other threads, e.g. https://github.com/react-native-google-signin/google-signin/issues/1148 https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/386

Given the 2 most recent are from use chrome mobile webview, it might be similar to the cordova-plugin where trying to use native auth (as on an android device) when really it should be using browser auth. It might work to tweak the sign in code to handle native device explicitly, e.g.

 public async signInWithGoogle() {
    return FirebaseAuthentication.signInWithGoogle({skipNativeAuth: !Capacitor.isNativePlatform()});
  }

Or this might even be fixed with the v6 plugins (haven't tested) - but I'd say might be good to see if reproducible based on hypothesis above or anything else