Laravel with firebase (A message can only have one of the following targets: condition, token, topic, unknown)

Viewed 685

Here is the message error:

{
    "message": "A message can only have one of the following targets: condition, token, topic, unknown",
    "exception": "NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification",
    "file": "/app/vendor/laravel-notification-channels/fcm/src/Exceptions/CouldNotSendNotification.php",
    "line": 13,
    "trace": [
        {
            "file": "/app/vendor/laravel-notification-channels/fcm/src/FcmChannel.php",
            "line": 84,
            "function": "serviceRespondedWithAnError",
            "class": "NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification",
            "type": "::"
        },
        {
            "file": "/app/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php",
            "line": 148,
            "function": "send",
            "class": "NotificationChannels\\Fcm\\FcmChannel",
            "type": "->"
        },
}
1 Answers

This is related to updates to the PHP firebase packages. I was using the versions described bellow when it was working:

Package Version
kreait/firebase-php 6.3.1
kreait/firebase-tokens 3.0
google/cloud-storage v1.27.0
google/cloud-core v1.45.0

If I update the packages from my app the notifications break with the same error message you described. Try going back the older versions listed above.

Related