iOS EAS Build Fails – “Distribution certificate hasn’t been imported successfully”
I’m developing a React Native app using Expo SDK 54. The Android build works perfectly, and the app runs fine on iPhone devices via expo start --tunnel. However, I’m encountering an issue when building for iOS through EAS for TestFlight testing.
I don’t have an Apple Developer account—a collaborator who owns one has provided me with:
- .p8 key file (App Store Connect API key)
- Key ID and Issuer/Developer ID
- Bundle ID
- .mobileprovision profile
- .p12 distribution certificate (created on Windows using OpenSSL)
All credentials were uploaded via credentials.json, and the build starts but fails with:
“Distribution certificate with fingerprint [XXXX] hasn’t been imported successfully”
Could this be due to:
- A mismatch between the provisioning profile and certificate?
- The .p12 being generated on Windows instead of macOS using KeyChain?
What troubleshooting steps should I try next? Should we recreate the .p12 file on a macOS device?
iOS EAS build failures with distribution certificate import issues typically stem from certificate provisioning profile mismatches, incorrect certificate format, or corrupted certificate files. The error “Distribution certificate hasn’t been imported successfully” almost always indicates that the certificate fingerprint in your EAS configuration doesn’t match what’s actually in your uploaded certificate file, or there’s a fundamental issue with how the certificate was created or exported.
Contents
- Understanding the Certificate Import Error
- Common Causes of Certificate Import Failures
- Troubleshooting Steps for iOS Certificate Issues
- Creating Proper .p12 Files on Different Platforms
- EAS Configuration and Credential Management
- Advanced Verification Techniques
- Preventative Measures for Future Builds
Understanding the Certificate Import Error
The error message “Distribution certificate with fingerprint [XXXX] hasn’t been imported successfully” is a specific EAS build error that indicates a mismatch between what EAS expects and what it receives during the certificate validation process. This error typically occurs during the build initialization phase when EAS attempts to verify your iOS distribution credentials.
When you submit a build, EAS performs several validation checks:
- Verifies the certificate format and integrity
- Checks if the certificate matches the provisioning profile
- Validates the certificate fingerprint against what’s stored in your EAS configuration
- Ensures the certificate hasn’t been revoked by Apple
The fingerprint mentioned in the error is the SHA-1 hash of your certificate’s public key. If this fingerprint doesn’t match what EAS expects, or if the certificate itself is malformed, you’ll receive this error.
Common Causes of Certificate Import Failures
Certificate-Provisioning Profile Mismatch
The most common cause of this error is indeed a mismatch between your distribution certificate and provisioning profile. When your collaborator created these credentials, they must have:
- Generated the distribution certificate on their Mac using Keychain Access
- Created a provisioning profile specifically for that certificate
- Ensured both use the same App ID and bundle identifier
- Made sure the certificate hasn’t been revoked or expired
If these credentials were created at different times or by different methods, they might not be compatible.
Windows-Generated .p12 Certificate Issues
Creating a .p12 certificate on Windows using OpenSSL is highly problematic for iOS development. Here’s why:
- Keychain Integration: iOS certificates are designed to be created and managed through macOS Keychain Access, which maintains proper certificate chains and attributes
- Export Limitations: OpenSSL exports certificates without the complete certificate chain, which Apple requires
- Format Differences: Windows-generated certificates often lack the proper extensions and attributes needed for iOS distribution
- Password Protection: The password handling might differ between platforms, leading to corruption
Corrupted or Improperly Formatted Certificate Files
Even if created on macOS, certificate files can become corrupted during:
- Transfer between devices
- Email attachments
- Compression/decompression
- Text encoding issues
Troubleshooting Steps for iOS Certificate Issues
Step 1: Verify Certificate Fingerprints
First, let’s verify what EAS expects vs. what you have:
# Check your EAS configuration
eas build:configure
# List your credentials
eas credentials:list
Compare the fingerprint mentioned in the error with the actual certificate fingerprint:
# On macOS (if you have access)
openssl x509 -in your_certificate.p12 -noout -fingerprint -sha1
# On Windows (if you must use Windows)
openssl pkcs12 -in your_certificate.p12 -nodes -passin pass:your_password | openssl x509 -noout -fingerprint -sha1
Step 2: Validate Certificate-Provisioning Profile Pairing
Check if your provisioning profile matches your certificate:
- Install the .mobileprovision file on a Mac with Xcode
- Open it in Xcode → Organizer → Devices
- Verify it’s linked to the correct distribution certificate
- Check that the App ID/bundle identifier matches your app
Step 3: Test with Xcode Direct Build
Before trying EAS again, test your credentials with a direct Xcode build:
- Install the .p12 and .mobileprovision on a Mac
- Create a simple iOS project in Xcode
- Configure the project with your bundle identifier
- Attempt to archive and export
If this fails, your credentials have fundamental issues regardless of EAS.
Step 4: Clean and Re-upload Credentials
Sometimes EAS gets confused with cached credential data:
# Remove existing credentials
eas credentials:remove
# Re-upload fresh credentials
eas credentials:import --path credentials.json
Creating Proper .p12 Files on Different Platforms
The macOS Method (Recommended)
The only reliable way to create iOS distribution certificates is on a Mac with proper Apple Developer account access:
- Open Keychain Access on the collaborator’s Mac
- Go to Keychain Access → Certificate Assistant → Request a Certificate from a Certificate Authority
- Fill in your email and select “Saved to disk”
- Once approved, export the certificate as a .p12 file from Keychain Access
- Use the default Keychain Access export options (include private key, use strong password)
Windows Workaround (Not Recommended)
If you absolutely must use Windows:
- Install OpenSSL for Windows
- Use these exact commands:
# Convert certificate to PEM format
openssl pkcs12 -in certificate.p12 -out certificate.pem -nodes -passin pass:your_password
# Create new PKCS12 with proper headers
openssl pkcs12 -export -out certificate_fixed.p12 -inkey certificate.pem -in certificate.pem -password pass:your_new_password
- Test thoroughly before using with EAS
Certificate Validation Script
Create this script to validate your certificate before uploading:
#!/bin/bash
# certificate_check.sh
CERT_FILE="$1"
PASSWORD="$2"
echo "Checking certificate format..."
openssl pkcs12 -in "$CERT_FILE" -passin pass:"$PASSWORD" -nokeys -out /tmp/cert.pem
echo "Certificate details:"
openssl x509 -in /tmp/cert.pem -text -noout | grep -E "(Subject:|Issuer:|X509v3 Key Usage:|X509v3 Extended Key Usage:)"
echo "Certificate fingerprint:"
openssl x509 -in /tmp/cert.pem -noout -fingerprint -sha1
echo "Checking certificate chain..."
openssl verify -CAfile /tmp/cert.pem /tmp/cert.pem
EAS Configuration and Credential Management
Proper credentials.json Structure
Ensure your credentials.json follows this exact structure:
{
"ios": {
"distributionCertificate": {
"filename": "distribution.p12",
"password": "your_certificate_password",
"id": "your_certificate_id",
"teamId": "your_team_id"
},
"provisioningProfile": {
"filename": "profile.mobileprovision",
"id": "your_profile_id"
}
}
}
Environment-Specific Credentials
Consider using different credentials for development vs. distribution:
# For development builds
eas build --platform ios --profile development
# For distribution builds
eas build --platform ios --profile distribution
Credential Rotation Strategy
Apple certificates expire annually. Implement a rotation strategy:
- 60 days before expiration: Notify team
- 30 days before expiration: Generate new certificates
- 7 days before expiration: Test new credentials
- Day of expiration: Switch to new credentials
Advanced Verification Techniques
Certificate Chain Verification
Verify your certificate has the proper chain:
# Check certificate chain
openssl x509 -in your_cert.p12 -noout -text | grep -A 10 "Authority Information Access"
Look for Apple root certificates in the chain.
Provisioning Profile Analysis
Deep-dive into your provisioning profile:
# Extract profile details
security cms -D -i profile.mobileprovision > profile.plist
# Check profile contents
cat profile.plist | grep -E "(application-identifier|provisioned-profiles|entitlements)"
EAS Build Log Analysis
Examine the full EAS build log for more detailed error information:
eas build --platform ios --local --log-format raw
Look for specific error codes and timestamps around the certificate validation step.
Preventative Measures for Future Builds
Automated Certificate Monitoring
Set up monitoring for certificate expiration:
#!/bin/bash
# check_cert_expiration.sh
openssl x509 -in cert.p12 -noout -enddate | cut -d= -f2
Run this weekly and send alerts if expiration is within 60 days.
Centralized Credential Management
Consider using a secure credential management system:
- HashiCorp Vault
- AWS Secrets Manager
- GitHub Secrets (for smaller teams)
Build Environment Standardization
Standardize your build process:
- Use macOS-based CI/CD pipelines
- Implement certificate signing scripts
- Maintain documentation for credential procedures
Regular Credential Audits
Conduct quarterly audits of:
- Certificate validity
- Profile-app certificate matching
- Team member access permissions
- Security of credential storage
Sources
- Expo EAS Build Documentation - iOS Configuration
- Apple Developer Documentation - Distribution Certificate Creation
- OpenSSL Certificate Management Guide
- React Native iOS Build Best Practices
- EAS Troubleshooting Guide - Certificate Issues
Conclusion
The “Distribution certificate hasn’t been imported successfully” error is most likely caused by either a certificate-provisioning profile mismatch or the Windows-generated .p12 file lacking proper iOS certificate attributes. Recreating the .p12 file on a macOS device using Keychain Access is strongly recommended as the Windows OpenSSL method often produces certificates that Apple’s systems reject.
Start by verifying certificate fingerprints and testing with direct Xcode builds before attempting EAS again. Implement proper credential management practices to prevent similar issues in the future, and always use macOS for iOS certificate creation and management. If your collaborator can regenerate the credentials on their Mac, this will likely resolve the issue immediately.