[Expo] "Could not find APNs credentials" problem

Unfortunately, from time to time, I face some problems with my credentials for PUSH notifications. When I try to send PUSH through Expo PUSH Broadcaster, it responds with an error “Could not find APNs credentials for {bundleIdentifier} (@{user}/{app_slug}). You may need to generate or upload new push credentials.”. When I’m writing this - I have no idea why it’s happening, but I know how to fix it fast.

Certificates everywhere

If your app uses PUSHes, you have to deliver (or generate through Expo services) some certificates, necessary to properly sending notifications. One of them is the APN key for iOS applications.

Right now, Expo delivers a sufficient CLI tool for certificate management, through which you can add or remove your keys. It’s available by command expo credentials:manager and it allows you to check all your credentials which are stored on Expo servers. You can also connect a particular key with the application, which is required for PUSH notifications.

The problem is that sometimes, randomly, the key is no longer connected with the app and we receive an error above.

Reconnect your keys

As I mentioned, I still don’t know the reason, why it is happening, but if you are looking for a temporary solution, go through these steps:

  • In your project folder, log in to Expo account:

    • $ expo login
  • Check if your ./app.json file has proper info, especially for expo.ios.bundleIdentifier property.
  • Run Expo Credentials Manager:

    • $ expo credentials:manager
    • Choose the ios platform
    • Select action: Use existing Push Notifications Key in current project
    • and next, select your APN key

After that, your APN key is reconnected to the app and everything should work fine again.

Summary

It’s not a rock-solid solution, because the situation could come back. But in the case of PUSH notifications, a fast reaction to problems is necessary, so I hope it will work for you before you find a better solution.