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

InvalidArgumentError should not cause deactivation of token #223

Open
daadu opened this issue Nov 3, 2022 · 8 comments
Open

InvalidArgumentError should not cause deactivation of token #223

daadu opened this issue Nov 3, 2022 · 8 comments

Comments

@daadu
Copy link

daadu commented Nov 3, 2022

Potential causes include invalid registration, invalid package name, message too big, invalid data key, invalid TTL, or other invalid parameters.

Invalid registration: Check the format of the registration token you pass to the server. Make sure it matches the registration token the client app receives from registering with Firebase Notifications. Do not truncate or add additional characters.

Invalid package name: Make sure the message was addressed to a registration token whose package name matches the value passed in the request.

Message too big: Check that the total size of the payload data included in a message does not exceed FCM limits: 4096 bytes for most messages, or 2048 bytes in the case of messages to topics. This includes both the keys and the values.
Invalid data key: Check that the payload data does not contain a key (such as from, or gcm, or any value prefixed by google) that is used internally by FCM. Note that some words (such as collapse_key) are also used by FCM but are allowed in the payload, in which case the payload value will be overridden by the FCM value.

Invalid TTL: Check that the value used in ttl is an integer representing a duration in seconds between 0 and 2,419,200 (4 weeks).
Invalid parameters: Check that the provided parameters have the right name and type.

^^ from firebase docs

I think this should NOT cause deletion of token. In my case I had a bug in sending message - some arg (TTL) was not proper. This caused tokens to be removed permanently.

Following could be the solution

  1. EITHER remove this from fcm_error_list [my preferred solution]
  2. OR add a config DEACTIVE_ON_INVALID_ARGUMENT_ERROR (or something), to enable/disbale this behaviour
@daadu
Copy link
Author

daadu commented Nov 3, 2022

@xtrinch Let me now, what do you think about it - I will file PR for it.

@xtrinch
Copy link
Owner

xtrinch commented Nov 3, 2022

I think perhaps you're right that this does not qualify for token deactivation

@daadu
Copy link
Author

daadu commented Nov 3, 2022

I also noticed that the token is deleted on the Firebase server as well. Not sure whether the module is pruning it (calling some delete APIs on Firebase) or it happens because of the InvalidArgumentError

@daadu
Copy link
Author

daadu commented Nov 3, 2022

I also noticed that the token is deleted on the Firebase server as well.

Noticed that once deleted from Django-server, when I ask for fcmToken on client side I get a new one (not the deleted one).

@daadu
Copy link
Author

daadu commented Nov 3, 2022

If firebase also deletes them, then I think it is the correct behavior.

@daadu
Copy link
Author

daadu commented Nov 3, 2022

I tested and noticed this with iOS only, not sure it is the same for other platforms.

@xtrinch
Copy link
Owner

xtrinch commented Nov 3, 2022

This module doesn't delete any tokens. If firebase deletes them, then it's OK if this module does too

@daadu
Copy link
Author

daadu commented Nov 3, 2022

Need to confirm this behaviour, I am using flutter clients - which are wrapper around native libraries. Also not sure if this happens with Android tokens as well.

Keeping this issue open, until this is verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants