Questions on changes to the push notification service

Context

With v29.0.0 push notifications are now asynchronously delivered, with step 1 processing push Tickets to see whether Expo enqueued notifications and step 2 processing push Receipts to see whether Apple or Google successfully received the notification.

The example README code within the Node SDK (https://github.com/expo/exponent-server-sdk-node) imply that the response format for both Tickets and Receipts are the same, namely DeviceNotRegistered | MessageTooBig | MessageRateExceeded | InvalidCredentials.

Questions

  1. Are the 4 errors listed above the only 4 possible errors that we can get back? Does each apply to Tickets, Receipts, or both? The reason I ask is because from my own testing, it looks like DeviceNotRegistered and MessageTooBig are ever only returned in Tickets, implying that they’ll never be returned in Receipts (we never get a Receipt ID in that case).

  2. Are there sample Receipt Ids that we can use to test error scenarios? I’m not exactly sure how to trigger MessageRateExceeded, InvalidCredentials, or any other possible errors to ensure that I’m acting on them properly.

Thanks,
Mike

Hi @mikey - to answer your questions:

  1. Those four error values are the only four the server will return (at the time of this post at least). Also, not all receipts for failed notifications will contain details or details.error. They apply to both tickets and receipts. You should check for the errors in both.

  2. There aren’t any sample receipt IDs to test for those errors, but it’s a good idea. Even if you can’t trigger them, you can handle them by checking to see if receipt/ticket.details && receipt/ticket.details.error equal any of those error codes. I’d recommend especially checking for InvalidCredentials, since sometimes developers upload corrupt certificates, the wrong password, etc. and the InvalidCredentials error in the receipt is how information about the broken push credentials gets passed back.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.