Apple credentials are unavailable

I’ve created new apple certificates (p12, p8, mobileprovision profile, csr etc) and when I run expo fetch:ios:certs, it gives me the following:

These credentials are associated with Apple Team ID: QZSWQ9759H
Save these important values as well:

Distribution P12 password: (not available)
Push Key ID:               (not available)
Push P12 password:         (not available)

I’m guessing that this is also why I am unable to build the app.
Why is this happening? I’ve deleted and created all my certificates so many times. They exist in my apple developer account and I’ve downloaded them too.

  Expo CLI 3.20.1 environment info:
    System:
      OS: macOS Mojave 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^37.0.0 => 37.0.8 
      react: 16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 
      react-navigation: ^2.18.2 => 2.18.2 
    npmGlobalPackages:
      expo-cli: 3.20.1

Can you check in expo credentials:manager if they show up?
Were there any errors when generating credentials?
By “I’ve created new apple certificates” do you mean that you have done it manually on apple developer portal or did you select “let expo handle …” when running expo build:ios?

Hi @wkozyra , thank you for replying. When I type ‘expo credentials:manager’ I get the following:

Fetching available credentials
ApiV2Error: An unknown error occurred.
    at ApiV2Client._requestAsync (/@expo/xdl@57.9.1/src/ApiV2.ts:219:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'INTERNAL_SERVER_ERROR',
  details: undefined,
  serverStack: undefined,
  _isApiError: true

I’ve created all of my certificates manually on the apple developer portal.

Can you try ?
EXPO_LEGACY_API=true expo fetch:ios:certs

and if this won’t work try providing those files again with

EXPO_LEGACY_API=true expo build:ios --clear-credentials

@wkozyra
When I ran EXPO_LEGACY_API=true expo fetch:ios:certs I got:

Ozges-MacBook-Air:mani-react ozgecokyasar$ EXPO_LEGACY_API=true expo fetch:ios:certs
Retrieving iOS credentials for @ozgecokyasar/manifestation-react
These credentials are associated with Apple Team ID: QZSWQ9759H
Save these important values as well:

Distribution P12 password: (not available)
Push Key ID:               (not available)
Push P12 password:         (not available)

All done!

on running EXPO_LEGACY_API=true expo build:ios --clear-credentials I got:

Requesting session...
Authenticated with Apple Developer Portal successfully!
Only 1 team associated with your account, using Apple Team with ID: QZSWQ9759H
Fetching available credentials
An unknown error occurred.

Hi
I cleared credentials manually in db, can you try again?

Also I noticed that you changed your bundleidentifier few times for one app, so I just want to remind you that credentials are keyed by pair of values on a server (slug + bundle identifier) so when you change it from expo perspective it’s separate app

Thanks @wkozyra, unfortunately neither of these work.
I’m still getting the same results.

Can you post full output of the build command (with sensitive parts redacted)?

@wkozyra ,

this is the full output:

Ozges-MacBook-Air:mani-react ozgecokyasar$ expo build:ios
? Choose the build type you would like: archive

SDK34 will be deprecated next! We recommend upgrading versions, ideally to the latest (SDK37), so you can continue to build new binaries of your app and develop in the Expo client.


Checking if there is a build in progress...

Configuring credentials for ozgecokyasar in project manifestation-react
? Do you have access to the Apple account that will be used for submitting this app to the App Store? Yes
Please enter your Apple Developer Program account credentials. These credentials are needed to manage certificates, keys and provisioning profiles in your Apple Developer account.
The password is only used to authenticate with Apple and never stored
Learn more here (​https://bit.ly/2VtGWhU​)
? Apple ID: XYZ@gmail.com
? Password (for XYZ@gmail.com): [hidden]
Authenticating to Apple Developer Portal...
Authenticated with Apple Developer Portal successfully!
Only 1 team associated with your account, using Apple Team with ID: XYZ
Fetching available credentials
Failed to prepare all credentials. 
The next time you build, we will automatically use the following configuration:
Fetching available credentials
An unknown error occurred.

@wkozyra update: when I run expo credentials:manager, this is what I get:

ozgecokyasar@Ozges-MacBook-Air mani-react % expo credentials:manager
Configuring credentials for ozgecokyasar in project manifestation-react
? Select platform ios
Fetching available credentials
ApiV2Error: An unknown error occurred.
    at ApiV2Client._requestAsync (/@expo/xdl@57.9.3/src/ApiV2.ts:219:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at IosApi._fetchAllCredentialsApi (/usr/local/lib/node_modules/expo-cli/src/credentials/api.ts:67:12)
    at IosApi._fetchAllCredentials (/usr/local/lib/node_modules/expo-cli/src/credentials/api.ts:71:24)
    at IosApi.getAllCredentials (/usr/local/lib/node_modules/expo-cli/src/credentials/api.ts:61:7)
    at SelectIosExperience.open (/usr/local/lib/node_modules/expo-cli/src/credentials/views/Select.ts:36:28)
    at CredentialsManager.run (/usr/local/lib/node_modules/expo-cli/src/credentials/route.ts:42:12)
    at runCredentialsManagerStandalone (/usr/local/lib/node_modules/expo-cli/src/credentials/route.ts:8:3)
    at /usr/local/lib/node_modules/expo-cli/src/commands/credentials.ts:30:7
    at Command.<anonymous> (/usr/local/lib/node_modules/expo-cli/src/exp.ts:85:7) {
  code: 'INTERNAL_SERVER_ERROR',
  details: undefined,
  serverStack: undefined,
  _isApiError: true
}
? Do you want to quit Credential Manager Quit Credential Manager

Hi

Previously I assumed that problem was with recently credentials, so I just removed last entry, but after going through all entries I found one that was malformed, it was provisioning profile from 2018-12-20, after recent changes expo-cli is fetching all user credentials and despite the fact that this one was not used request failed when decrypting that record. Normally clear-credentials would fix that, but mentioned provisioning profile was for app with the same name, but different bundle identifier.

It should work now, sorry for your troubles.

I’m still having issues building. On “expo build:ios -c” I get the following error:

? Apple ID: ozgecokyasar@gmail.com
? Password (for ozgecokyasar@gmail.com): [hidden]
Trying to authenticate with Apple Developer Portal...
Available session is not valid any more. Continuing with normal login.
Authentication with Apple Developer Portal failed!
Reason: Unknown reason, raw: "Operation timed out - connect(2) for \"olympus.itunes.apple.com\" port 443"
Set EXPO_DEBUG=true in your env to view the stack trace.

I’ve downgraded to expo-cli version 3.1.2 and I am now able to get information on my credentials via “expo credentials: manager”. However, I’ve noticed that in the list of Application credentials, none of them have the bundleIdentifier that my app has. I was also getting certificates under User credentials that I had already deleted on apple dev portal, which I’ve now removed via the “Remove Push Notification credentials” option as seen in the below output.

Available credentials for iOS apps

Application credentials

  Experience: @ozgecokyasar/manifestation-react, bundle identifier: com.egzo.prana
    Provisioning profile is missing. It will be generated durring the next build
    Apple Team ID: QZSWQ9759H,  Apple Team Name: ---------

  Experience: @ozgecokyasar/manifestation-react, bundle identifier: com.manifest.prana
    Provisioning profile is missing. It will be generated durring the next build
    Apple Team ID: QZSWQ9759H,  Apple Team Name: ---------

  Experience: @ozgecokyasar/manifestation-react, bundle identifier: com.ozge.prana
    Provisioning profile is missing. It will be generated durring the next build
    Apple Team ID: QZSWQ9759H,  Apple Team Name: ---------

  Experience: @ozgecokyasar/manifestation-react, bundle identifier: com.prana-manifesation-app.prana
    Provisioning profile is missing. It will be generated durring the next build
    Apple Team ID: QZSWQ9759H,  Apple Team Name: ---------


User credentials



? What do you want to do? (Use arrow keys)
  ---- Current project actions ----
❯ Use existing Push Notifications Key in current project 
  Use existing Distribution Certificate in current project 
  ---- Account level actions ----
  Remove Provisioning Profile 
  Add new Push Notifications Key 
  Remove Push Notification credentials 
  Update Push Notifications Key 
  Add new Distribution Certificate 
  Remove Distribution Certificate 
  Update Distribution Certificate 

When I want to add new certificates via the above options, I get the following error:

Trying to authenticate with Apple Developer Portal...
Available session is not valid any more. Continuing with normal login.
Authentication with Apple Developer Portal failed!
Error: Reason: Unknown reason, raw: "Operation timed out - connect(2) for \"olympus.itunes.apple.com\" port 443"
    at runAction (/expo-cli@3.1.2/src/appleApi/fastlane.ts:28:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at authenticate (/expo-cli@3.1.2/src/appleApi/authenticate.ts:46:40)
    at Context.ensureAppleCtx (/expo-cli@3.1.2/src/credentials/context.ts:44:24)
    at generatePushKey (/expo-cli@3.1.2/src/credentials/views/IosPushCredentials.ts:274:3)
    at CreateIosPush.provideOrGenerate (/expo-cli@3.1.2/src/credentials/views/IosPushCredentials.ts:50:12)
    at CreateIosPush.create (/expo-cli@3.1.2/src/credentials/views/IosPushCredentials.ts:27:24)
    at CreateIosPush.open (/expo-cli@3.1.2/src/credentials/views/IosPushCredentials.ts:37:21)
    at runCredentialsManager (/expo-cli@3.1.2/src/credentials/route.ts:17:22)
    at /expo-cli@3.1.2/src/commands/credentials.ts:29:7 {
  rawDump: 'Operation timed out - connect(2) for "olympus.itunes.apple.com" port 443'
}

I was getting certificates that no longer exists in my apple dev portal. Does this mean that I’m receiving the wrong data? Could there be an issue with the Expo servers?

I’ve downgraded to expo-cli version 3.1.2

Did you try building before downgrading? 3.1.2 is a very old version of expo-cli, currently, apple API is available under different hostname and old version of expo-cli is trying to connect to old version

I’ve noticed that in the list of Application credentials , none of them have the bundleIdentifier that my app has.

As I mentioned before I removed last entry from credentials (there was only teamId there), so that’s why there is no entry for the current bundle identifier. When you ran clear credentials in the past it worked, the problem was with GET request that failed.

I was also getting certificates under User credentials that I had already deleted on apple dev portal

When you changed bundle identifier in app.json it’s treated as separate app, with separate set of credentials.

@wkozyra thank you for your help! I upgraded to the latest expo version and now the build is in the queue! Not sure what exactly fixed the issue but it works now! :pray:t3: :sweat_smile:

I got a similar issue when trying to work with Apple Distribution Certificate in credential manager. It says I need a --apple-id flag and EXPO_APPLE_PASSWORD env variable. I’ve got both set and even tried adding the env EXPO_APPLE_ID.

cjs-MBP13-2017:myapp cj$ expo credentials:manager
Configuring credentials for kickinespresso in project my-rewards
? Select platform ios
Fetching available credentials
Available credentials for iOS apps

Application credentials

  ...

User credentials

  ...


? What do you want to do? Add new Distribution Certificate
? Will you provide your own Apple Distribution Certificate? Let Expo handle the process
Error: In order to provide your Apple ID credentials, you must set the --apple-id flag and set the  environment variable.
    at _getAppleIdFromParams (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/appleApi/autenticate.ts:80:11)
    at _requestAppleIdCreds (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/appleApi/authenticate.ts:67:10)
    at authenticate (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/appleApi/authenticate.ts:47:46)
    at Context.ensureAppleCtx (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/context.ts:63:30)
    at generateDistCert (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/views/IosDistCert.ts:492:13)
    at CreateIosDist.provideOrGenerate (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/views/IosDistCert.ts:71:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at CreateIosDist.create (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/views/IosDistCert.ts:50:25)
    at CreateIosDist.open (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/views/IosDistCert.ts:55:22)
    at CredentialsManager.run (/Users/cj/.config/yarn/global/node_modules/expo-cli/src/credentials/route.ts:42:12)
? Do you want to quit Credential Manager (Use arrow keys)
❯ Quit Credential Manager 
  Go back to experience overview.

Here is my info:


  Expo CLI 3.20.9 environment info:
    System:
      OS: macOS Mojave 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 14.2.0 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.6 AI-192.7142.36.36.6392135
      Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^37.0.0 => 37.0.8 
      react: 16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4

This error message is intended for expo build:ios command, credntials:manger doesn’t support neither --apple-id option nor EXPO_APPLE_PASSWORD. You see this error because you specified env with a password, if EXPO_APPLE_PASSWORD is not set you will be asked about it

Are you saying that using the credentials:manager requires the EXPO_APPLE_PASSWORD to no be set?

yes

We’ll probably fix that in the future, but this behavior is not exactly bug.

1 Like

it may not exactly be a bug, but it is awfully confusing and unexpected behavior.

Edit:

Yeah, this is really awkward because I have to unset EXPO_APPLE_PASSWORD env that was initially set in the .bash_profile. After using credential:manager, I have to reset the EXPO_APPLE_PASSWORD to use build:ios

cjs-MBP13-2017:my_app cj$     expo build:ios --release-channel production \
>     --apple-id my@email.com \
>     --team-id XXXXXXXXX
? Choose the build type you would like: archive

Checking if there is a build in progress...

Configuring credentials for mycompany in project my-app
In order to provide your Apple ID credentials, you must set the --apple-id flag and set the EXPO_APPLE_PASSWORD environment variable.

…but it worked. Removing the EXPO_APPLE_PASSWORD did work for using the credential:manager