quickstart-python icon indicating copy to clipboard operation
quickstart-python copied to clipboard

firebase topic condition not expression doesn't work

Open jiamo opened this issue 7 years ago • 1 comments

I have a lib https://github.com/jiamo/pfcm to use firebase cloud message.

def test_pfcm_send_topic_include_not2():
    message_title = "topic"
    message_body = "{} body of message".format(datetime.datetime.now())

    fsmapi = FcmAPI(project_name, private_file)
    pfcm = Pfcm(fsmapi)
    topic = "!('test' in topics)"
    results = pfcm.send_msg(
        topic_condition=topic,
        message_title=message_title,
        message_body=message_body)

    for result in results:
        print(result)
        assert not "error"  in result

Got error:

F{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "message.condition",
            "description": "Invalid condition expression provided."
          }
        ]
      },
      {
        "@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
        "errorCode": "INVALID_ARGUMENT"
      }
    ]
  }
}


print the playload json: I already send email to firebase support(They said they are confirm it and need to wait to fix but don't know when)

'{"message": {"notification": {"title": "topic", "body": "2018-03-27 12:24:23.399014 body of message"}, "condition": "!(\'test\' in topics) && (\'test2\' in topics)"}}'

jiamo avatar Mar 08 '18 09:03 jiamo

Hi @jiamo would you be able to include the payload that pfcm generates in this case?

kroikie avatar Mar 26 '18 19:03 kroikie