matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
153 stars 139 forks source link

Fix `message` nesting when retrying Firebase v1 notifications #387

Closed devonh closed 2 weeks ago

devonh commented 2 weeks ago

The final step of building the notification body for Firebase v1 was setting the message key inside of the retry loop. This meant that on a retry, the message field would be recopied inside of itself leading to nested messages.

Since that is not a valid Firebase notification, it would lead to errors from Firebase like the following:

400 from server, we have sent something invalid! Error: 
'{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \\"message\\" at \'message\': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \\"message\\" at \'message\': Cannot find field."
          }
        ]
      }
    ]
  }
}'