eas build -> Error: Distribution certificate with fingerprint *************** hasn't been imported successfully

I’m trying to use eas build --local, but I’m getting the error below, does anyone have any idea what it is?

Error: Distribution certificate with fingerprint *************** hasn't been imported successfully
    at Keychain.ensureCertificateImported (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/keychain.js:54:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async IosCredentialsManager.prepareTargetCredentials (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:96:13)
    at async IosCredentialsManager.prepare (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:54:41)
    at async /usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:23:20
    at async BuildContext.runBuildPhase (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/context.js:44:28)
    at async Object.iosBuilder (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:22:29)
    at async Object.buildIosAsync (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/ios.js:43:27)
    at async Object.buildAsync (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/build.js:27:32)
    at async main (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/main.js:16:9)

Build failed
Distribution certificate with fingerprint ************ hasn't been imported successfully

@notbrent Could you give me the path and which files, I’m trying but I’m not succeeding, could you help me?

Sorry about asking this again, but i am facing the same error and don’t know how to clear the certificates from the keychain. I have already deleted the certificate from within eas credentials and generated a new one, but the error continues.

@integralmedica and @pablohduda

Do you see any relevant certificates in the Keychain Access app on your Mac?

This are the certificates in the Keychain Access.

image

The Iphone Distribution I manually added it later to try something.
I don’t think they are relevant, but I am not sure about the Apple Worldwide Developer.
Should i delete all of them?

I’ve set the credentials to “local” in eas.json and my credentials.json is like this:

{
  "ios": {
    "distributionCertificate": {
      "path": "credentials/ios/dist-cert.p12",
      "password": "xxxxx"
    },
    "provisioningProfilePath": "credentials/ios/profile.mobileprovision"
  }
}

The paths are as imported by eas credentials.

Thanks for the help

Apple worldwide ... is required for building and it should be there, if anything iPhone Distribution might be a problem. The local build is creating a new keychain and imports your credentials there, but when reading it’s possible that values from Login or System keychain take precedence and it’s checking the wrong one

Also,

  • check other keychains
  • you are currently listing certificates, switch that view to all or at least check the keys tab
  • if you are seeing keychains named turtle-v2-... then delete them, cli should clean that up but if a build was aborted unexpectedly, cleanup might have failed

Hi, wkozyra.

There is no turtle-v2 under “all” tabs in system or login.

I’ve removed the Iphone Distribution but the problem persists.

This is under all tabs in system now:
image

Build output:

[PREPARE_CREDENTIALS] Preparing credentials
[PREPARE_CREDENTIALS] Creating keychain
[PREPARE_CREDENTIALS] Preparing credentials for target 'Psiqu'
[PREPARE_CREDENTIALS] Getting distribution certificate fingerprint
[PREPARE_CREDENTIALS] Writing distribution certificate to /var/folders/g1/tbf2q5t55f538lby6bdbyw4c0000gn/T/e04d4780-c59b-40f4-bc75-082dc89456ef.p12
[PREPARE_CREDENTIALS] Importing distribution certificate into the keychain
[PREPARE_CREDENTIALS] Initializing provisioning profile
[PREPARE_CREDENTIALS] Validating whether distribution certificate has been imported successfully
[PREPARE_CREDENTIALS] Destroying keychain - /var/folders/g1/tbf2q5t55f538lby6bdbyw4c0000gn/T/turtle-v2-1bf2783c-3d54-424b-8eb0-917fd0e4b7d0.keychain
[PREPARE_CREDENTIALS] 
Error: Distribution certificate with fingerprint *********** hasn't been imported successfully
    at Keychain.ensureCertificateImported (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/keychain.js:54:19)
    at async IosCredentialsManager.prepareTargetCredentials (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:96:13)
    at async IosCredentialsManager.prepare (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:54:41)
    at async /usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:23:20
    at async BuildContext.runBuildPhase (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/context.js:44:28)
    at async Object.iosBuilder (/usr/local/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:22:29)
    at async Object.buildIosAsync (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/ios.js:43:27)
    at async Object.buildAsync (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/build.js:27:32)
    at async main (/usr/local/lib/node_modules/eas-cli-local-build-plugin/dist/main.js:16:9)

Build failed
Distribution certificate with fingerprint ******* hasn't been imported successfully

what about other keychains? by default there exists at least 2 system and login, you are showing only one fo them (probably system one).

when suggesting to remove turtle-v2 I was talking about keychains named turtle-v2-..... not sth in you existing keychain, but if you don’t see anything like that it should be fine

Also, are you sure those credentials are correct? maybe consider generating them via eas-cli instead of using credentials.json

These are in “login”:

image

I’ve generated a new certificate yesterday, tried to build with eas-cli credentials and nothing changes.
I’m probably missing something simple :confused:

Used the new certificate to build with “expo build” and it worked.

I’ve looked at this location:

Destroying keychain - /var/folders/g1/tbf2q5t55f538lby6bdbyw4c0000gn/T/turtle-v2-1bf2783c-3d54-424b-8eb0-917fd0e4b7d0.keychain

And this keychain is not there. I assume the destroy command worked.