Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_messaging]: App sometimes crashes on background messages due to FirebaseAuth #12806

Closed
5 tasks done
Navil opened this issue May 20, 2024 · 0 comments · Fixed by #12810
Closed
5 tasks done

[firebase_messaging]: App sometimes crashes on background messages due to FirebaseAuth #12806

Navil opened this issue May 20, 2024 · 0 comments · Fixed by #12810
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: messaging resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@Navil
Copy link

Navil commented May 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Are you aware of the differences between iOS and Android background message handling?

  • I understand that iOS and Android background messages behave differently, and I've designed my application with that in mind.

Do you have an active Apple Developer account?

  • I have an active Apple Developer account.

Are you using a physical iOS device to test background messages?

  • I am using a physical iOS device to test background messages.

Have you enabled "Remote Notifications" & "Background Mode" (Checking options for "Background Processing" & "Remote Notifications") in your app's Xcode project?

image

Have you created an APNs key in your Apple Developer account & uploaded this APNs key to your Firebase console?

image

Have you disabled method swizzling for Firebase in your app?

The key is not in my info.plist file

Are you sending messages to your app from the Firebase Admin SDK?

const message = {
        notification: {
          title: title,
          body: messageData.text,
        },
        data: {
          ...messageData,
          badge: String(numMessages),
        },
        apns: {
          payload: {
            aps: {
              "content-available": 1,
              badge: numMessages,
            },
          },
        },
        token: token,
      };

      if (!admin) {
        admin = require("firebase-admin");
        const firebase_credentials = context.values.get("firebase_credentials");
        const doc = JSON.parse(firebase_credentials);
        admin.initializeApp({
          credential: admin.credential.cert(doc),
        });
      }
      await admin.messaging().send(message);

Have you requested permission from the user to receive notifications?

  • I have the relevant permission to receive notifications.

Have you used the 'Console' application on your macOS device to check if the iOS device's system is throttling your background messages?

Not relevant

Additional context and comments

My Flutter app (production) shows crashes when users receive notifications. This is nothing I can recreate, and it "only" happens to around 100 users.

According to my backend logs, this crash seems to happen when a notification is being sent to a user. My assumption is, that this is happening while the app is in the background.

Normal notifications (and background notifications) work fine in most cases.

I am currently not having "Background processing" enabled in Xcode, as I followed the documentation when setting up Firebase Messaging.

image image
@Navil Navil added Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working labels May 20, 2024
@TarekkMA TarekkMA added the resolution: fixed A fix has been merged or is pending merge from a PR. label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: messaging resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet
2 participants