Push notification are not working on flutter web

[Problem/Question]
Web notifications don’t work. I’m in HTTP V1, they work fine when I send a firebase notification (so it’s not a flutter configuration problem), everything is set-up properly on my side.


// If problem, please fill out the below. If question, please delete.
[SDK Version]
sendbird_chat_sdk: 4.2.10

[Reproduction Steps]
1/ enable notification
2/ add firebase messaging
3/ try to received a notification on WEB

PS : It’s working when I send notification from firebase.

[Frequency]
Always

[Current impact]
Very strong

Can you share with us your FCM implementation for push? It’s possible that FCM sends Data notifications were as Sendbird by default does not. Have you attempted to test via the Sendbird Dashboard?

Hello Tyler,
Yes I tried throught the dashboard and I received nothing.
I don’t know how to share my configuration, but :

  • Push notifications: enabled
  • Push notifications for multi-device users: Send to devices both offline and online
  • Channel unread count in push notification payload: enabled
  • FCM: HTTP v1 - Project ID: yumi-preprod

Template :
Title: {channel_name}
Body text: {sender_name}: {message}

How can I give you more information ?

Thanks

Sorry, I should have been more specific. I’m looking to see your actual push implementation code.

Additionally, were you able to successfully send a push from the Sendbird Dashboard’s push tester?

Hello Tyler,

  • I tried from Firebase, it’s working on my app.
  • I tried from Sendbird Dashboard, it was not
  • I tried from the chat itself, was not working neither.

It seems that the bridge between Sendbird and Firebase is not working, even with FCM HTTP V1 set-up.

@System_Yumi

It looks like are a few successful push attempts but anything that fails returns the following error from FCM:

UNREGISTERED

Which according to FCM:

UNREGISTERED (HTTP error code = 404) App instance was unregistered from FCM. This usually means that the token used is no longer valid and a new one must be used.
This error can be caused by missing registration tokens, or unregistered tokens.
Missing Registration: If the message's target is a token value, check that the request contains a registration token.
Not registered: An existing registration token may cease to be valid in a number of scenarios, including:
- If the client app unregisters with FCM.
- If the client app is automatically unregistered, which can happen if the user uninstalls the application. For example, on iOS, if the APNs Feedback Service reported the APNs token as invalid.
- If the registration token expires (for example, Google might decide to refresh registration tokens, or the APNs token has expired for iOS devices).
- If the client app is updated but the new version is not configured to receive messages.
For all these cases, remove this registration token from the app server and stop using it to send messages.

Hello Tyler,
Im trying to renew tokens, test and it’s still not working (but working from Firebase directly).
Could we set-up a quick 10/15 minutes call to check what is going on please ?
Thank you very much,
Joyd

@System_Yumi,

Unfortunately due to the nature of my schedule, I’m unavailable for customer calls. That being said, I took a look at the application_ids associated with your account and I don’t see any logs from the last few days. Can you tell me what application_id you’re using?

Im using this one : 2947902E-75F4-404D-B822-273353866E0A

Here is how I add a device :

Future<void> addDevice(UserService userService) async {
    if (dotenv.env['ACTIVATE_FIREBASE'] != "true" || sendbird.SendbirdChat.currentUser == null) {
      logger.i("Firebase integration is not activated or user is not connected.");
      return;
    }
    logger.i("Adding device token for notifications...");
    final NotificationSettings settings = await FirebaseMessaging.instance.getNotificationSettings();

    // Check if the notification permissions are granted
    if ({AuthorizationStatus.authorized, AuthorizationStatus.provisional}.contains(settings.authorizationStatus)) {
      final String? token = await FirebaseMessaging.instance.getToken(vapidKey: dotenv.env['FIREBASE_VAPID_KEY']);
      if (token != null) {
        try {
          await sendbird.SendbirdChat.registerPushToken(type: sendbird.PushTokenType.fcm, token: token);
          logger.i("Device token registered successfully.");

          userService.addDevice(token);
        } catch (e) {
          logger.e("Failed to register device token: $e");
        }
      } else {
        logger.e("Failed to retrieve the FCM token.");
      }
    } else {
      logger.i("Notification permissions are not authorized or provisional.");
    }
  }

Thanks for that. I’ll have to apologize because I seem to have missed a pretty glaring aspect of this conversation in that you’re attempting to use push in Flutter Web. Sendbird has historically never supported web based push notifications.

That being said, assuming the FCM key is correct, you shouldn’t have many issues. I looked through your application and realized the user you utilize to test has a number of FCM keys associated with it. I’ve removed all but the latest token, and attempted to send a push for you. According to the results back from the FCM API, it was a success.

I tested utilizing the Push Tester in Settings > Chat > Push Notifications. Can you tell me how you were testing today as the only logs I see for your application in the last few days are from the me using the push tester tool just now.

Hello Tyler!
I don’t know how I could be more clear, we are in a flutter forum, my title is “on flutter web”.
Also, when I discussed with your sales team + Rajan, they made perflectly clear that it was working on web.

That being said, I received your test notification :

For testing, I connect myself with an other user, and send a message to this user (mine).

My test are done on this channel : sendbird_group_channel_367300540_9a740216410e791c0dcfc020654a08d93d0eff32

Do I miss something here ? Why is this working with you but not with me ?
Also, this user has a lot of tokens, because it’s been a while Im trying to make it works…

Thanks

I totally agree with you. The title was very clear. I knew we were discussing flutter, I simply overlooked the web portion of it. That is 100% my fault there. Anyways, since you received the successful push from the Sendbird Dashboard tester, it’s important to look at the example using an actual channel.

I don’t see any inherent issues with your implementation or the configuration of the user, channel or application. That being said, I did make one change to a flag on our side. Can you give it another test?

Hello Tyler,

No problem, thanks for taking take to help me here :slight_smile:

It seems that I received something, but I have an error :

Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

Where does this error originate? Is it from the FCM handler? Is this when you click on the push? What is the URL that you’re trying to navigate to?

This error happens when I send a message from an other account and I think its from the notification I receive, but Im not sure.

So, these look unrelated to Sendbird. I did a quick google of the long error about the dartlang-sdk and there are many issues regarding it on the flutter github. Why the FCM payload would cause this, I’m unsure. Unfortunately, all of the github issues I’ve found are closed for inactivity.

I understand what you are saying, but when I receive notification directly from firebase it’s working ?

Sure, and I do assume you didn’t get this error when I sent it via the Dashboar. That being said, something in the push handler must be doing something unique compared to when the other pushes were sent which is causing it to try and pull the file. I will say, all of the errors that I saw regarding this were specific to Flutter web. Can you find out specifically where in the stack this gets thrown? Add some debugging steps maybe to help us understand where in the process this breaks?

Also I’d like to note, that it’s now 830PM KST (where I’m located), so I’ll be heading out for the night.