firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.52k stars 1.44k forks source link

Potential reduction in calls to `didReceiveRegistrationToken` starting Jun 24th #13284

Closed jalapenobagel closed 1 month ago

jalapenobagel commented 1 month ago

Description

Code flow: We rely on the didReceiveRegistrationToken method from the Firebase iOS SDK to receive registration tokens from FCM. Once this method is called, we call a GraphQL mutation on our end to register the token on our backend.:

func messaging(
  _ messaging: Messaging,
  didReceiveRegistrationToken fcmToken: String?
) {
    // GQL mutation 
}

Issue Starting Jun 24th, we're seeing a drop in FCM tokens registered on our backend, affecting 40% of new users.

Reproducing the issue

This issue was not reproducible locally, either with a local, Testflight, or production build. Scenarios we tried:

Additionally, we checked, for those users missing tokens on our backend, whether didReceiveRegistrationToken was called, and it was not in any of the scenarios.

We have also looked through code changes on our client around that time, and none seem to affect this codepath.

Firebase SDK Version

10.24.0

Xcode Version

15.0

Installation Method

Swift Package Manager

Firebase Product(s)

Messaging

Targeted Platforms

iOS

Relevant Log Output

N/A since the issue was not reproducible locally

If using Swift Package Manager, the project's Package.resolved

Expand snippet
``` { "identity" : "firebase-ios-sdk", "kind" : "remoteSourceControl", "location" : "https://github.com/firebase/firebase-ios-sdk", "state" : { "revision" : "42eae77a0af79e9c3f41df04a23c76f05cfdda77", "version" : "10.24.0" } } ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml Replace this line with the contents of your Podfile.lock! ```
jalapenobagel commented 1 month ago

Adding comment to update that this also seems to be disproportionately affecting users who have not provided us with notifications permissions on iOS.

Our code does not register these users for APNS notifications.

center.requestAuthorization(options: options) { [weak self] granted, _ in
  guard granted else {
    return
  }

  DispatchQueue.main.async {
    application.registerForRemoteNotifications()
  }
}

Is it possible that there were Firebase server changes that would cause a token to not be sent out in such cases (where the user is not registered for remote notifications) where they were previously being sent?

rizafran commented 1 month ago

Hi @jalapenobagel, upon checking, it looks like Firebase Support team already handled your issue. Regarding your second comment, I tried to replicate the issue but I was able to register my token. Also per checking, there are no changes made in the backend regarding the registration of token. What I could recommend for now is to try updating to the latest SDK version and see if that would fix your issue.

I'll now be closing this ticket, but feel free to comment if you still encounter any issues.