Building with a specified push token for iOS breaks notifications

Please provide the following:

  1. SDK Version: 36.0.0
  2. Platforms(Android/iOS/web/all): iOS

There have been a couple threads on this issue already this year:


Both appear to have timed out and not been resolved.

The issue is if you “expo build:ios” and let expo handle the push token, things work fine. If you generate your own, or download the one expo generated (via expo fetch:ios:certs) and then specify them on a build like this:

${expo_cmd} build:ios --non-interactive --clear-credentials --release-channel "$channel" \
  --dist-p12-path ${IOS_KEY_PATH}/App.p12 --team-id ${IOS_TEAM_ID} \
  --provisioning-profile-path ${IOS_KEY_PATH}/App.mobileprovision \
  --push-id ${IOS_PUSH_NOTIFICATIONS_KEY_ID} --push-p8-path ${IOS_KEY_PATH}/App.p8 \
  --apple-id ${IOS_APPLE_ID}

Then the build succeeds but any attempt to send a push notification to iOS ends up with this error:
“The Apple Push Notification service key for your account could not be loaded, likely due to a malformed p8 file. Expo needs a valid PEM key in order to deliver notifications to APNs.”
This is using the p8 file either directly downloaded from Apple or downloaded from Expo with the fetch command.

The workaround is to do this command:

${expo_cmd} build:ios --non-interactive --clear-credentials --release-channel "$channel" \
  --dist-p12-path ${IOS_KEY_PATH}/App.p12 --team-id ${IOS_TEAM_ID} \
  --provisioning-profile-path ${IOS_KEY_PATH}/App.mobileprovision \
  --apple-id ${IOS_APPLE_ID}

Which leaves everything out about the push notification and ends up generating a new push token every build. Note that you don’t have to deploy the app to the Apple app store etc. This just “fixes” the token with Expo and push notifications start working again.

For context we’re using a CI server to build these (manually triggered) to avoid permission issues.

It seems that the functionality to provide in input p8 file is broken and sounds like what was going on in the other posts.

Recreation seems to be this:

  1. Build and generate all items with expo
  2. Download them all from Expo
  3. Build again specifying all the items will be provided
  4. Try to do a push to the target

Replying to my own post so it doesn’t age out. Anyone out there?