Skip to content

Receiving invalid-argument error code instead of invalid-registration-token when sending push notification #187

Closed
@Nyshiki

Description

@Nyshiki
  • Operating System version: Ubuntu 16.04
  • Firebase SDK version: firebase-admin 2.12.0 on Python 3.5.2
  • Firebase Product: messaging

Describe the problem
Hi there,
When I send a push notification using messaging.send with an invalid token I expect an invalid-registration-token error but and invalid-argument error is raised. The invalid token is generated adding an extra char at the end of the token. Is this the expected behavior? With the legacy HTTP API an invalid token error was returned.
Thanks

Relevant Code:

from firebase_admin import messaging
app = firebase_admin.get_app()
token = VALID_TOKEN+"a"

try:
    result = messaging.send(
        message=messaging.Message(
            notification=messaging.Notification(
                  title="Push",
                  body="message"
             ),
             token=push_id
         ),
         app=app)
except messaging.ApiCallError as error:
    assert error.code == "invalid-registration-token"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions