Firebase Admin SDK always returns OK when sending a push notification

641 views
Skip to first unread message

saitz.peter

unread,
Aug 9, 2018, 10:51:10 AM8/9/18
to Firebase Google Group
Why does the Firebase Admin SDK always return OK when sending a push notification, even if no iOS- and no Android-App has been assigned to the project? 
Firebase always returns HTTP status 200 ("OK") with a body(payload) somthing like "projects/my-project-name/messages/1234567890123456789", where the number is the message id. 
When no App is assigned to the project, I would expect HTTP status 4xx with a error message.

How to differentiate between success and failure?

Hiranya Jayathilaka

unread,
Aug 9, 2018, 1:00:17 PM8/9/18
to fireba...@googlegroups.com
Admin SDK (and the underlying REST API) hands the message off to FCM for delivery. You get a 200 OK if this hand off is successful. The delivery to an app happens later in the cloud. That's out of the control of the Admin SDK/REST API. This is typical in most pubsub messaging systems. Publisher does not block/fail on the state of the subscriber.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c69b17a1-5ffc-45b5-a541-a560d279b4ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Hiranya Jayathilaka | Software Engineer | h...@google.com | 650-203-0128

saitz.peter

unread,
Aug 10, 2018, 5:27:39 AM8/10/18
to Firebase Google Group
An API or REST call should not return "OK" if preconditions fail (e.g. no SmartPhone app assigned to project). If Firebase always returns "OK", we have to live with that circumstance.

Hiranya Jayathilaka

unread,
Aug 10, 2018, 12:58:44 PM8/10/18
to fireba...@googlegroups.com
That depends. If you're sending a message to a topic, sender should be able to send anytime regardless of if there are any subscribers on the topic or not. That level of temporal decoupling is inherent in the pubsub model. I believe you do get an error when sending to a non-existing device token.

On Fri, Aug 10, 2018 at 2:27 AM saitz.peter <peter...@bawagpsk.com> wrote:
An API or REST call should not return "OK" if preconditions fail (e.g. no SmartPhone app assigned to project). If Firebase always returns "OK", we have to live with that circumstance.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages