Push notification error: "Could not find APNs credentials" for standalone app

I’m seeing an error on the backend when we try to push a notification to a client. Here’s the error from the backend (Python):

<30>Feb  1 15:09:51 api[2988]: 2018-02-01 15:09:51,822 [WARNING] core.integrations.providers.expo_notification,61 Error pushing message
{
  u'token': 'ExponentPushToken[sFGvdTIvzjid3eAt1laAJT]',
  u'push_response': OrderedDict([
    ('push_message', PushMessage(to='ExponentPushToken[sFGvdTIvzjid3eAt1laAJT]', data={
      u'order_id': 225615,
      u'created_at': '2018-02-01T15:09:50.819832+00:00',
      u'push_type': u'sms_received',
      u'message': u'Can you do the harvest kale salad?'
    },
    title=None, body=u'SMS Received', sound=u'default', ttl=None, expiration=None, priority=None, badge=None)), ('status', u'error'), ('message', u'Could not find APNs credentials for com.snapkitchen.enterprise.snapstasher (@jugglebird/istasher). Check whether you are trying to send a notification to a detached app.'), ('details', None)]), u'message': u'SMS Received', u'extra': {u'order_id': 225615, u'created_at': '2018-02-01T15:09:50.819832+00:00', u'push_type': u'sms_received', u'message': u'Can you do the harvest kale salad?'}} :

PushResponseError: Could not find APNs credentials for com.snapkitchen.enterprise.snapstasher (@jugglebird/istasher). Check whether you are trying to send a notification to a detached app.   File "/usr/local/lib/python2.7/dist-packages/exponent_server_sdk/__init__.py", line 177, in validate_response     raise PushResponseError(self)

From other discussions, it looks like the token may not be associated with the version of the app we have in production (we had to re-publish with new credentials a few weeks ago). If that’s the case, it looks like I can just remove these tokens and the client will resend the token on next load, does that sound right or should I do something else?

One piece of context that may help is to know that Expo push tokens work quite similarly to how Apple’s tokens work with APNs, since Expo’s server is a relatively thin service that relays notifications to Apple. Expo needs valid APNs credentials to send push notifications. And as with APNs in general (not specific to Expo), it doesn’t matter what APNs credentials you had at the time an iOS device provided a device token – the APNs credentials just need to be valid at the time of sending the notification.

So if you revoke your APNs credentials or clear them from Expo, or if your APNs credentials expire (APNs p12 certificates expire after one year), Apple will reject all of your push notifications until you provide Expo with valid APNs credentials. To be clear, your Expo push tokens and the underlying iOS device tokens are still valid and will still work once you provide new, valid APNs credentials.

In this case, the error “Could not find APNs credentials for…” means that Expo does not have any copy of your APNs credentials (currently a p12 certificate). You will need to let Expo recreate the credentials for you (recommended for most developers – run exp build:ios -c to clear all of them and then run exp build:ios to let Expo re-provision them) or upload your own credentials from Apple’s developer center (be sure to follow the instructions carefully).

That is helpful. I had to revoke the APN credentials when trying to work around some build errors at the beginning of the year. But Expo should have the new credentials as they were uploaded with the most recent build.

I did notice when running exp fetch:ios:certs that the push p12 password comes back as ‘undefined’. Is there a chance that Expo didn’t persist the password that I entered during the app build?

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