laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
476 stars 123 forks source link

Optional Logging? #153

Closed haleyngonadi closed 1 year ago

haleyngonadi commented 1 year ago

Hey, I'm wondering if you could please help me understand how to turn on optional logging with this package. I send out notifications to thousands of users every day and some of their tokens are no longer valid so my logs are getting clogged like crazy with the following message:

[2023-06-27 07:00:06] production.ERROR: 

The message could not be delivered to the device identified by 'XXXX'.

Although the token is syntactically correct, it is not known to the Firebase
project you are using. This could have the following reasons:

- The token has been unregistered from the project. This can happen when a user
  has logged out from the application on the given client, or if they have
  uninstalled or re-installed the application.

- The token has been registered to a different Firebase project than the project
  you are using to send the message. A common reason for this is when you work
  with different application environments and are sending a message from one
  environment to a device in another environment.

 {"exception":"[object] (NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification(code: 0): 

How do I handle this? Is there a way to remove invalid tokens? Can I turn off this exception somewhere?

haleyngonadi commented 1 year ago

Closing as this comment answers my question :)