can't build ios : Failed to set up Distribution Certificate

I’ve always been able to build my app for ios successfully, until this issue came up.
As usual I typed : expo build:ios -t archive
It’s not working anymore because I get this error:

“Failed to fetch Apple distribution certificates”
“Failed to set up Distribution Certificate”
“Received an internal server error from App Store Connect / Developer Portal, please try again later”

I can’t build my app for ios anymore, can anyone help me pls?
Here is my expo diagnostics :

Expo CLI 4.10.1 environment info:
System:
OS: Windows 10 10.0.19041
Binaries:
Node: 14.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - C:\Users\User\AppData\Roaming\npm\yarn.CMD
npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
API Levels: 29, 30
Build Tools: 29.0.2, 30.0.3
System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
IDEs:
Android Studio: Version 4.2.0.0 AI-202.7660.26.42.7351085
npmPackages:
expo: ~42.0.1 => 42.0.3
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
Expo Workflow: managed

1 Like

It literally turned out to be Apple’s server-side problem. About 40 minutes later I retried and it worked.

1 Like

I had the same issue when i tried after a moment it didn’t go away and tried again after that and i got the same error which is:

“Failed to sync capabilities com.domain.appname
Failed to prepare all credentials.
The next time you build, we will automatically use the following configuration:”

After that i checked on my apple dev account i found profile certificate status is invalid then i removed it and i tried but nothing change.
Is there any solution to build the app or fix this issues?

1 Like

Same here! Started getting this 2 days ago. Yesterday I was able to build once like it was a flaky server-side error on Apple, but today just cannot get through :dizzy_face:

Likewise. I tried to build yesterday and have been troubleshooting all morning. I just noticed the latest forum posts are about this (with slightly different errors).

For me it fails at fetching the Apple provisioning profiles. I only use this Macbook to build my app and did not change anything configuration-wise. Did update expo-cli and all the things but no luck. I guess we can not build ios apps until Apple fixes things?

I had the same thing, i wrote about it yesterday on the forum. Most likely this is a problem on the Apple side. Maybe we just need to wait and Apple will fix it. But if you don’t want to wait, here how I was able to fix this problem:

  • I removed all keys, certificates, profiles (excluding Identifiers: if you have an app in appstore, you will not be able to do this anyway), via the command - expo build:ios -c
  • Then I added them manually via - developer.apple.com
  • run command expo build:ios -t archive
  • and when it asks me about keys, certificates, etc. I choose the option where I upload them myself
  • The build is successfully created and I upload it through eas submit -p ios --url <YourBuildUrl> in appstoreconnect
1 Like

Ah thanks! I can wait a few days more but if this doesn’t get fixed before that I will definitely try your solution =)

A little update here: the error message changes every time I try, and it almost feels like it works 1 out of 100 attempts. I said that I waited like 40 minutes and I tried re-building and it worked, yeah only once and this problem started again.
I already have my app published no AppStore so changing profile, keys and certificates would be risky.
Considering Android is building OK, and that a lot of people are having the same issues right now, I’m certain that Apple should fix this internal server error.

Yeah, I’m holding back on removing keys/certificates etc. for a while longer. Did made my own post with extensive information. Maybe someone sees something that’s out of the ordinary.

Yes, errors are always different. I agree that it is not worth doing like me if deleting the current certificate, key or provision profiles can harm your application. But yesterday I tried to create a build all day and nothing helped me except the method that I described

These are all in the green though.

Just retried multiple times and it worked without creating new keys or certificates.
Then I tried again just to make sure they fixed it, but nah, internal server error again.
I guess Apple should really look into their server.
I recommend retrying it until it gets through. I think I tried more than 100 times though.

Same issue here. “Error: Received an internal server error from App Store Connect” but at different stages each time. Sometimes while “Syncing capabilities”, sometimes while “Linking bundle identifier” and sometimes while “Fetching Apple provisioning profiles”. :frowning:

So while the errors are coming from apple, there are a few possibilities:

  • Apple is having genuine issues (most likely, given the range of different issues)
  • Expo build nodes are at fault and are not calling apple’s APIs correctly
  • Apple have changed their APIs, are rolling out across nodes, and Expo needs to update to accommodate the changes

It’d be good to get the input of someone in the know on this?

we’ll investigate this further tomorrow (monday). this impacts other tools as well, see this fastlane issue, for example.

if you have successfully run a build before, you don’t need to communicate with apple at all to run another build. we just do this to validate the credentials in case they are expired.

if you are using expo build: expo build:ios --skip-credentials-check
if you are using eas build: eas build -p ios --non-interactive

3 Likes

Amazing, thanks for the tip @notbrent - was just investigating those options!

And thanks for the link to the underlying Fastlane issue.

to clarify - we don’t use fastlane for this but fastlane uses the same apple api, and so that helps to confirm that there is something going on with the apple side of things

1 Like

Also having the same problem using expo build:os

Received an internal server error from App Store Connect / Developer Portal, please try again later

I’m not trying to create any certs or profiles, just select previously used ones.

I am new to use apple cert.
I have created a cert in developer.apple.com by crs, I downloaded .cer and export it to .p12 in mac
When I upload the .p12 to expo.io, it requires
Apple Distribution Certificate Password and Apple Distribution Certificate Private Signing Key, how could I obtain it?