Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eas build -p ios --profile development --local , error Distribution certificate with fingerprint xxxxxxxxxxx hasn't been imported successfully #1331

Closed
PROMEDIK-INDONESIA opened this issue Sep 1, 2022 · 41 comments
Assignees

Comments

@PROMEDIK-INDONESIA
Copy link

Build/Submit details page URL

https://expo.dev/accounts/dirabbieto/projects/iidi-project/builds/0fbe0224-2b74-420c-99f5-2ff56e8b8d47

Summary

i want to install React Native Google Mobile Ads (https://github.com/invertase/react-native-google-mobile-ads) on my project, but when i finished setup and run eas build -p ios --profile development --local on my terminal, it shows error Error: Distribution certificate with fingerprint *************** hasn't been imported successfully.

Managed or bare?

managed

Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 12.4
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 14.19.3 - ~/.nvm/versions/node/v14.19.3/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v18.4.0/bin/yarn
      npm: 6.14.17 - ~/.nvm/versions/node/v14.19.3/bin/npm
      Watchman: 2022.08.22.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    IDEs:
      Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~46.0.9 => 46.0.9 
      react: 18.0.0 => 18.0.0 
      react-native: 0.69.5 => 0.69.5 
    Expo Workflow: managed
expo doctor
✖ Dependency tree validation for expo-modules-autolinking failed. This validation is only available on Node 16+ / npm 8.
✖ Dependency tree validation for @expo/config-plugins failed. This validation is only available on Node 16+ / npm 8.
✖ Dependency tree validation for @expo/prebuild-config failed. This validation is only available on Node 16+ / npm 8.
✖ Dependency tree validation for @unimodules/core failed. This validation is only available on Node 16+ / npm 8.
✖ Dependency tree validation for @unimodules/react-native-adapter failed. This validation is only available on Node 16+ / npm 8.
✖ Dependency tree validation for react-native-unimodules failed. This validation is only available on Node 16+ / npm 8.
🎉 Didn't find any issues with the project!

Error output

[RUN_EXPO_DOCTOR] Running "expo doctor"
[RUN_EXPO_DOCTOR] - Finding all copies of expo-modules-autolinking
[RUN_EXPO_DOCTOR] ✖ Dependency tree validation for expo-modules-autolinking failed. This validation is only available on Node 16+ / npm 8.
[RUN_EXPO_DOCTOR] [10:36:18] No dependencies found for expo-modules-autolinking
[RUN_EXPO_DOCTOR] - Finding all copies of @expo/config-plugins
[RUN_EXPO_DOCTOR] ✖ Dependency tree validation for @expo/config-plugins failed. This validation is only available on Node 16+ / npm 8.
[RUN_EXPO_DOCTOR] [10:36:18] No dependencies found for @expo/config-plugins
[RUN_EXPO_DOCTOR] - Finding all copies of @expo/prebuild-config
[RUN_EXPO_DOCTOR] ✖ Dependency tree validation for @expo/prebuild-config failed. This validation is only available on Node 16+ / npm 8.
[RUN_EXPO_DOCTOR] [10:36:19] No dependencies found for @expo/prebuild-config
[RUN_EXPO_DOCTOR] 
[RUN_EXPO_DOCTOR] [10:36:25] 🎉 Didn't find any issues with the project!
[PREPARE_CREDENTIALS] Preparing credentials
[PREPARE_CREDENTIALS] Creating keychain
[PREPARE_CREDENTIALS] Preparing credentials for target 'iidiproject'
[PREPARE_CREDENTIALS] Getting distribution certificate fingerprint
[PREPARE_CREDENTIALS] Writing distribution certificate to /var/folders/pp/5mmg-d4fn7m22bs86gd5z80000gq/T/b1c6bd60-21a7-4041-8d51-d715692d2b9c.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/pp/5mmg-d4fn7m22bs86gd5z80000gq/T/turtle-v2-53cb8ca3-f7d2-4186-a808-04fb6ef67a6e.keychain
[PREPARE_CREDENTIALS] 
Error: Distribution certificate with fingerprint xxxxxxxxx hasn't been imported successfully
    at Keychain.ensureCertificateImported (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/keychain.js:54:19)
    at async IosCredentialsManager.prepareTargetCredentials (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:100:13)
    at async IosCredentialsManager.prepare (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/ios/credentials/manager.js:58:41)
    at async /Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:54:20
    at async BuildContext.runBuildPhase (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/context.js:50:28)
    at async buildAsync (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:53:29)
    at async Object.iosBuilder (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/node_modules/@expo/build-tools/dist/builders/ios.js:24:33)
    at async buildIosAsync (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/dist/ios.js:54:12)
    at async buildAsync (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/dist/build.js:42:32)
    at async main (/Users/dira/.npm/_npx/26667/lib/node_modules/eas-cli-local-build-plugin/dist/main.js:16:9)

Build failed
Distribution certificate with fingerprint xxxxxxxxxxx hasn't been imported successfully
    Error: npx exited with non-zero code: 1
- Compressing project files

Reproducible demo or steps to reproduce from a blank project

https://snack.expo.dev/@dirabbieto/expo-google-admob-setup

@PROMEDIK-INDONESIA PROMEDIK-INDONESIA added the needs review Issue is ready to be reviewed by a maintainer label Sep 1, 2022
@dsokal dsokal removed the needs review Issue is ready to be reviewed by a maintainer label Sep 1, 2022
@dsokal dsokal self-assigned this Sep 1, 2022
@dsokal
Copy link
Contributor

dsokal commented Sep 1, 2022

Are you getting this error repeatedly? When running eas build --local do you see any popup asking to unblock the keychain?

@PROMEDIK-INDONESIA
Copy link
Author

Are you getting this error repeatedly? When running eas build --local do you see any popup asking to unblock the keychain?

when i tried to running eas build --local, it still gives the same error and there is no popup appear.

@dsokal
Copy link
Contributor

dsokal commented Sep 1, 2022

Do you use credentials.json?

@PROMEDIK-INDONESIA
Copy link
Author

Do you use credentials.json?

no, i don't. should i add it to my root project?

@dsokal
Copy link
Contributor

dsokal commented Sep 1, 2022

No, you don't if you don't need local credentials. I'm just trying to understand the problem.
If I understand correctly, you can build the project without --local flag without any problems?

@PROMEDIK-INDONESIA
Copy link
Author

No, you don't if you don't need local credentials. I'm just trying to understand the problem. If I understand correctly, you can build the project without --local flag without any problems?

yes, it works without any problems.

@dsokal
Copy link
Contributor

dsokal commented Sep 1, 2022

It seems stupid but can you try restarting your Mac and running local build again?

@PROMEDIK-INDONESIA
Copy link
Author

It seems stupid but can you try restarting your Mac and running local build again?

yes, already did that, but still it gives the same error. The error says Distribution certificate with fingerprint xxxx hasn't been imported successfully, is there any chance to import distribution certificate manually?

@mrevanschan
Copy link

same issue for me... build is working on eas server but not on --local. Already tried factory reseting my m1 and following steps from here with fresh project...

@KiwiKilian
Copy link

KiwiKilian commented Sep 2, 2022

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

@PROMEDIK-INDONESIA
Copy link
Author

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

hi kiwi, thank you so much for this, your explanation solved my problem.

also thank you @dsokal for helping me!

@rokasta12
Copy link

@ KiwiKilian
Just wanted to say thanks 🚀

@NameNull
Copy link

成功了。。。微信:yjavacn

@NameNull
Copy link

https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer

@garyThrels
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

Same issue happened again with latest Xcode 14.2 and this certificate solved it

@johnslemmer
Copy link

I was running in to this issue and fixed it by opening xcode and logging in to my apple developer account inside xcode. Hope that helps.

@micksar
Copy link

micksar commented Sep 15, 2023

Thanks a lot @KiwiKilian .
You solved my problem

@arnabdotpy
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

Thanks a lot man. This worked

@iamemiliano
Copy link

I usually run "eas build --profile production --platform ios" on Windows and since yesterday I get the following error:
Preparing credentials Creating keychain Preparing credentials for target 'XXXX' Getting distribution certificate fingerprint and common name Fingerprint = "XXXXXXXXXXXXXXXXXXXXXXXX", common name = XXXXXX Writing distribution certificate to /var/folders/dz/XXXXXXX Importing distribution certificate into the keychain Initializing provisioning profile Validating whether distribution certificate has been imported successfully Destroying keychain - /var/folders/dz/XXXXXXX/T/turtle-v2-XXXXXXX Distribution certificate with fingerprint XXXXXX hasn't been imported successfully

Do you have any ideas?

@KiwiKilian
Copy link

KiwiKilian commented Oct 30, 2023

@iamemiliano This issue is only about using --local regarding an iOS build on macOS. Therefore your problem on windows is totally different.

@TarifEzaz
Copy link

@KiwiKilian's solution works with additional step mentioned here: https://discussions.apple.com/thread/2737481?sortBy=best

@maniteja-emmadi
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

Thank you so much for this.

@maison-shibumi
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

this is still very relevant in 2024 - thanks!!

@kweenyl-frog
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

thank you very much! this solved my issue!

@SamJbori
Copy link

hy this certificate is missi

Just wanted to say thanks!

@AlbertCardo
Copy link

AlbertCardo commented Mar 27, 2024

Steps:

  1. Download the certificate file https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer
  2. Install it with:
security add-trusted-cert -d -r unspecified -k ~/Library/Keychains/login.keychain-db ~/Downloads/AppleWWDRCAG3.cer

(I found the command in StackOverflow.)

@alexsyeo
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

Thanks for this! Worked for me.

@oottoohh
Copy link

oottoohh commented May 8, 2024

am i need regenerate provisioning profile after install Apple Worldwide Developer Relations Certification Authority ? @PROMEDIK-INDONESIA @KiwiKilian

@nightness
Copy link

I was experiencing the same problem. While trying to debug I manually downloaded the Distribution Certificate from the Credentials section on the EAS dashboard. When adding it to my macOS keychain (password is provided in .md file in the download) it shows the Certificate is untrusted.

Following this thread I was missing this newer "Apple Worldwide Developer Relations Certification Authority" certificate. After adding this Apple certificate the distribution certificate is also trusted. Furthermore deleting the distribution certificate again and then running a --local iOS build successfully downloads the distribution certificate and gets added to the keychain.

I'm not sure, why this certificate is missing, as Apple states it should have been updated with XCode.

Thanks. Wish I found this three hours ago! 😁

@hasankemaldemirci
Copy link

Cheers ✨ @KiwiKilian

@makeable
Copy link

makeable commented Oct 4, 2024

I had this issue too. I fixed it by just building an app directly in xcode. I guess it must have updated whatever it needed, and now local eas builds work fine.

@bromeooo
Copy link

This works locally for me. I'm running --local builds in github actions and getting

Distribution Certificate is not validated for non-interactive builds.

which i believe is related. Is there a fix for this issue when fetching certs --non-interactive --local in gha? Locally the fix in the comment above did work.

@cryptobench
Copy link

@bromeooo Did you find a solution to this?

@bromeooo
Copy link

@cryptobench yes. This error is misleading, it just means expo can't find ANY certs. Try generating certs with the cli and making sure your build is pointed at the right expo project (with the certs).

@cryptobench
Copy link

@bromeooo Does that mean you upload your cert to the github repo? I am finding it hard to find any documentation that points me towards logging into apple somehow via the github actions runner.

@bromeooo
Copy link

@cryptobench so expo will set you up. If you use expo - cli locally and run a build with eas. It will prompt you to log in and generate certs for you. The certs are linked to your apple account and will exist on your project expo dashboard. After you do this locally you can run that same build on gh actions and it will find the certs non-interactive

@giorgosph
Copy link

Hello.

I have the same problem with my certificates. My EAS builds were working as expected until I have created a new App ID and certificates. The problem is that I do not have a Mac so I am using OpenSSL to handle the certificates.

Steps Taken

  1. I have created the new App ID
  2. I have created a keypair locally using OpenSSL and used the private.key to sign a .cer certificate
  3. I have created a new distribution certificate from my Apple Developer account using the .cer created above
  4. I used OpenSSL to issue a .p12 certificate using the private key and the distribution certificate

Note that I have also issued a certificate for APN.

After those changes the build fails at the "Prepare Credentials" step with error message:

Distribution certificate with fingerprint xxxxxxxxxxxxxxxxxx hasn't been imported successfully

@AugSync
Copy link

AugSync commented Jan 14, 2025

Estaba experimentando el mismo problema. Mientras intentaba depurar, descargué manualmente el Certificado de distribución de la sección Credenciales en el panel de EAS. Al agregarlo a mi llavero de macOS (la contraseña se proporciona en el archivo .md en la descarga), muestra que el Certificado no es confiable.

Después de seguir este hilo, me faltaba este certificado más reciente de "Autoridad de certificación de relaciones con desarrolladores de Apple a nivel mundial". Después de agregar este certificado de Apple, el certificado de distribución también es confiable. Además, al eliminar nuevamente el certificado de distribución y luego ejecutar una --localcompilación de iOS, se descarga correctamente el certificado de distribución y se agrega a la cadena de llaves.

No estoy seguro de por qué falta este certificado, ya que Apple indica que debería haberse actualizado con XCode .

Thanks, it works!!!

@melyux
Copy link

melyux commented Jan 23, 2025

@KiwiKilian's above workaround didn't work for me, it said SecCertificateAddToKeychain: The specified keychain could not be found.

@TarifEzaz's additional step worked to solve it though:

  1. wget https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer
  2. sudo security import AppleWWDRCAG3.cer -k /Library/Keychains/System.keychain

@brunojs02
Copy link

brunojs02 commented Feb 6, 2025

Hello guys i'm getting this error as well (inside expo builds), but in my case i don't have a mac so i follow this steps in my linux distro fedora

  • created a sign request (.csr) with openssl openssl req -nodes -newkey rsa:2048 -keyout private_key.key -out cer_sign_request.csr
  • created a certificate in https://developer.apple.com/account/resources/certificates/list and dowloaded it
  • transformed downloaded_certificate.cer in certificate.pem with openssl x509 -in downloaded_certificate.cer -inform DER -out certificate.pem -outform PEM
  • downloaded and transformed AppleWWDRCAG3.cer in AppleWWDRCAG3.pem with the command openssl x509 -in AppleWWDRCAG3.cer -inform DER -out AppleWWDRCAG3.pem -outform PEM
  • and finally export as certficate.p12 with command openssl pkcs12 -export -out certificate.p12 -inkey private_key.key -in certificate.pem -certfile AppleWWDRCAG3.pem

If someone already made this work, tell me the steps i should follow please

@mffonseca
Copy link

@KiwiKilian @AlbertCardo . Thanks for this! Worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests