fastlane icon indicating copy to clipboard operation
fastlane copied to clipboard

[iOS] deliver action error | altool - Unable to upload archive | Failed to generate JWT token

Open AfsarFresh opened this issue 2 years ago • 5 comments

New Issue Checklist

Issue Description

The deliver action fails to upload the build to TestFlight. The error seems to be related to the App Store Connect API Key and altool.

This is my first time trying out both the Fastlane and GitHub Actions. I followed this blog to setup the CD pipeline. All the lanes work except the upload_release. In it, I have the deliver action that results in the below error.

2023-12-04T01:38:46.4266500Z [01:38:46]: [33m[altool]     "Error Domain=ITunesConnectionAuthenticationErrorDomain Code=-26000 \"Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_***.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_***.p8, NSStringEncoding=4}\" UserInfo={NSLocalizedRecoverySuggestion=Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_***.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_***.p8, NSStringEncoding=4}, NSLocalizedDescription=Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_***.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_***.p8, NSStringEncoding=4}, NSLocalizedFailureReason=App Store operation failed.}"
Command executed
deliver(
  skip_screenshots: true,
  skip_metadata: true,
  skip_app_version_update: true,
  force: true,
  run_precheck_before_submit: false
)
Complete output when running fastlane, including the stack trace and command used
 Run bundle exec fastlane ios build_upload_testflight
  bundle exec fastlane ios build_upload_testflight
  shell: /bin/bash -e {0}
  env:
    PATH: /usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin
    ASC_KEY_ID: ***
    ASC_ISSUER_ID: ***
    ASC_KEY: ***
    SIGNING_KEY_PASSWORD: ***
    SIGNING_KEY_FILE_PATH: signing-cert.p1[2](https://github.com/companyName/appName-iOS/actions/runs/7080820352/job/19269238310#step:8:2)
[01:[3](https://github.com/companyName/appName-iOS/actions/runs/7080820352/job/19269238310#step:8:3)0:56]: Sending anonymous analytics information
[01:30:56]: Learn more at https://docs.fastlane.tools/#metrics
[01:30:56]: No personal or sensitive data is sent.
[01:30:56]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[01:30:56]: ------------------------------
[01:30:56]: --- Step: default_platform ---
[01:30:56]: ------------------------------
[01:30:56]: Driving the lane 'ios build_upload_testflight' 🚀
[01:30:56]: -------------------------------------------------
[01:30:56]: --- Step: Switch to ios load_asc_api_key lane ---
[01:30:56]: -------------------------------------------------
[01:30:56]: Cruising over to lane 'ios load_asc_api_key' 🚖
[01:30:56]: ---------------------------------------
[01:30:56]: --- Step: app_store_connect_api_key ---
[01:30:56]: ---------------------------------------
[01:30:56]: Cruising back to lane 'ios build_upload_testflight' 🚘
[01:30:56]: ------------------------------------------------
[01:30:56]: --- Step: Switch to ios prepare_signing lane ---
[01:30:56]: ------------------------------------------------
[01:30:56]: Cruising over to lane 'ios prepare_signing' 🚖
[01:30:56]: -----------------------------
[01:30:56]: --- Step: create_keychain ---
[01:30:56]: -----------------------------
[01:30:56]: $ security list-keychains -d user
[01:30:56]: ▸ "/Users/runner/Library/Keychains/signing-db"
[01:30:56]: Found keychain '/Users/runner/Library/Keychains/signing-db' in list-keychains, adding to search list skipped
[01:30:56]: --------------------------------
[01:30:56]: --- Step: import_certificate ---
[01:30:56]: --------------------------------
[01:30:56]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
[01:30:56]: ------------------
[01:30:56]: --- Step: sigh ---
[01:30:56]: ------------------

+------------------------------------------------------------+ | Summary for sigh 2.217.0 | +-------------------------------------+----------------------+ | api_key | ******** | | readonly | true | | adhoc | false | | developer_id | false | | development | false | | skip_install | false | | force | false | | include_mac_in_profiles | false | | app_identifier | com.clientName.***STG | | ignore_profiles_with_different_name | false | | skip_fetch_profiles | false | | include_all_certificates | false | | skip_certificate_verification | false | | platform | ios | | fail_on_name_taken | false | +-------------------------------------+----------------------+

[01:30:56]: Creating authorization token for App Store Connect API [01:30:56]: Fetching profiles... [01:30:57]: Verifying certificates... [01:30:59]: Found 1 matching profile(s) [01:30:59]: Downloading provisioning profile... [01:30:59]: Successfully downloaded provisioning profile... [01:30:59]: Installing provisioning profile... /Users/runner/work/-iOS/-iOS/AppStore_com.clientName.***STG.mobileprovision [01:30:59]: Setting Provisioning Profile type to 'app-store' [01:30:59]: Cruising back to lane 'ios build_upload_testflight' 🚘 [01:30:59]: ----------------------------------------------------------------- [01:30:59]: --- Step: Switch to ios fetch_and_increment_build_number lane --- [01:30:59]: ----------------------------------------------------------------- [01:30:59]: Cruising over to lane 'ios fetch_and_increment_build_number' 🚖 [01:30:59]: -------------------------------- [01:30:59]: --- Step: get_version_number --- [01:30:59]: -------------------------------- [01:31:00]: -------------------------------------------- [01:31:00]: --- Step: latest_testflight_build_number --- [01:31:00]: -------------------------------------------- [01:31:00]: Creating authorization token for App Store Connect API [01:31:01]: Fetching the latest build number for version 2.0.1 [01:31:01]: Latest upload for version 2.0.1 on ios platform is build: 17 [01:31:01]: ------------------------------------ [01:31:01]: --- Step: increment_build_number --- [01:31:01]: ------------------------------------ Current version of project *** is: 1 9

/Users/runner/work/-iOS/-iOS [01:31:03]: $ cd /Users/runner/work/-iOS/-iOS && agvtool new-version -all 18 && cd - [01:31:03]: ▸ Setting version of project *** to: [01:31:03]: ▸ 18. [01:31:03]: ▸ Also setting CFBundleVersion key (assuming it exists) [01:31:04]: ▸ Updating CFBundleVersion in Info.plist(s)... [01:31:04]: ▸ Updated CFBundleVersion in ".xcodeproj/..//Common/Configuration/plist/DEV Simulator Info.plist" to 18 [01:31:04]: ▸ Updated CFBundleVersion in ".xcodeproj/..//Common/Configuration/plist/Info.plist" to 18 [01:31:04]: ▸ Updated CFBundleVersion in ".xcodeproj/..//Common/Configuration/plist/STG Info.plist" to 18 [01:31:04]: ▸ Updated CFBundleVersion in ".xcodeproj/..//Common/Configuration/plist/TST Info.plist" to 18 [01:31:04]: ▸ Updated CFBundleVersion in ".xcodeproj/../Tests/Info.plist" to 18 [01:31:04]: ▸ /Users/runner/work/-iOS/-iOS [01:31:04]: Cruising back to lane 'ios build_upload_testflight' 🚘 [01:31:04]: ---------------------------------------------- [01:31:04]: --- Step: Switch to ios build_release lane --- [01:31:04]: ---------------------------------------------- [01:31:04]: Cruising over to lane 'ios build_release' 🚖 [01:31:04]: ------------------------------------------ [01:31:04]: --- Step: update_code_signing_settings --- [01:31:04]: ------------------------------------------

+-------------------------------------------------+ | Summary for code signing settings | +-----------------------+-------------------------+ | use_automatic_signing | false | | targets | ["*** STG"] | | code_sign_identity | Apple Distribution | | bundle_identifier | com.clientName.***STG | | profile_name | ***STG Distribution | | build_configurations | ["Release"] | | path | ***.xcodeproj | +-----------------------+-------------------------+

[01:31:04]: Updating the Automatic Codesigning flag to disabled for the given project '/Users/runner/work/-iOS/-iOS/.xcodeproj/project.pbxproj' [01:31:04]: Skipping *** not selected ( STG) [01:31:04]: Skipping Debug not selected (Release) [01:31:04]: Set Code Sign identity to: Apple Distribution for target: *** STG for build configuration: Release [01:31:04]: Set Provisioning Profile name to: STG Distribution for target: *** STG for build configuration: Release [01:31:04]: Set Bundle identifier to: com.clientName.STG for target: *** STG for build configuration: Release [01:31:04]: Skipping *** DEV not selected ( STG) [01:31:04]: Skipping *** DEV Simulator not selected ( STG) [01:31:04]: Skipping Tests not selected ( STG) [01:31:04]: Successfully updated project settings to use Code Sign Style = 'Manual' [01:31:04]: Modified Targets: [01:31:04]: * *** STG [01:31:04]: Modified Build Configurations: [01:31:04]: * Release [01:31:04]: ----------------------- [01:31:04]: --- Step: cocoapods --- [01:31:04]: ----------------------- [01:31:06]: $ bundle exec pod install --clean-install [01:31:13]: ▸ Analyzing dependencies [01:31:13]: ▸ Adding spec repo trunk with CDN https://cdn.cocoapods.org/ [01:31:13]: ▸ CocoaPods 1.14.3 is available. [01:31:13]: ▸ To update use: gem install cocoapods [01:31:13]: ▸ For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.14.3 [01:31:13]: ▸ Downloading dependencies [01:31:13]: ▸ Installing Alamofire (5.4.4) [01:31:15]: ▸ Installing Connectivity (5.0.0) [01:31:17]: ▸ Installing IQKeyboardManagerSwift (6.5.11) [01:31:20]: ▸ Installing JTAppleCalendar (8.0.4) [01:31:21]: ▸ Installing PinCodeTextField (0.1.0) [01:31:23]: ▸ Installing Socket.IO-Client-Swift (16.0.1) [01:31:24]: ▸ Installing Starscream (4.0.4) [01:31:25]: ▸ Installing lottie-ios (3.2.3) [01:31:29]: ▸ Generating Pods project [01:31:29]: ▸ Integrating client project [01:31:29]: ▸ Pod installation complete! There are 7 dependencies from the Podfile and 8 total pods installed. [01:31:29]: -------------------- [01:31:29]: --- Step: xcodes --- [01:31:29]: -------------------- [01:31:29]: Running xcodes version 1.4.1 [01:31:29]: $ /usr/local/bin/xcodes installed '14.3.1' [01:31:29]: ▸ /Applications/Xcode_14.3.1.app [01:31:29]: Setting Xcode version '14.3.1' at '/Applications/Xcode_14.3.1.app' for all build steps [01:31:29]: ----------------- [01:31:29]: --- Step: gym --- [01:31:29]: ----------------- [01:31:30]: Resolving Swift Package Manager dependencies... [01:31:30]: $ xcodebuild -resolvePackageDependencies -workspace ***.xcworkspace -scheme ***\ STG -configuration Release [01:31:31]: ▸ 2023-12-04 01:31:31.641 xcodebuild[7463:37875] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [01:31:31]: ▸ Command line invocation: [01:31:31]: ▸ /Applications/Xcode_14.3.1.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace .xcworkspace -scheme " STG" -configuration Release [01:31:31]: ▸ User defaults from command line: [01:31:31]: ▸ IDEPackageSupportUseBuiltinSCM = YES [01:32:36]: ▸ Resolve Package Graph

[01:34:19]: $ xcodebuild -showBuildSettings -workspace ***.xcworkspace -scheme ***\ STG -configuration Release 2023-12-04 01:34:22.199 xcodebuild[8974:42658] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [01:34:22]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout... 2023-12-04 01:34:23.790 xcodebuild[8976:42691] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [01:34:28]: Command timed out after 6 seconds on try 2 of 4, trying again with a 12 second timeout... 2023-12-04 01:34:30.473 xcodebuild[8981:42741] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) 2023-12-04 01:34:36.347 xcodebuild[8974:42809] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition 2023-12-04 01:34:36.974 xcodebuild[8976:42886] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition [01:34:40]: Command timed out after 12 seconds on try 3 of 4, trying again with a 24 second timeout... 2023-12-04 01:34:41.990 xcodebuild[9184:43331] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) 2023-12-04 01:34:43.348 xcodebuild[8981:43507] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition 2023-12-04 01:34:54.207 xcodebuild[9184:43628] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition [01:34:55]: Detected provisioning profile mapping: {:"com.clientName.***STG"=>"STG Distribution", :"country.appName.appNameapp"=>" AppStore - Jan 10, 2022", :"com.clientName.***TST"=>"match AppStore com.clientName.***TST"}

+-------------------------------------------------------------------------------------------------------------------------+ | Summary for gym 2.217.0 | +-------------------------------------------------------------+-----------------------------------------------------------+ | scheme | *** STG | | workspace | ***.xcworkspace | | configuration | Release | | export_options.method | app-store | | export_options.provisioningProfiles.com.clientName.***STG | ***STG Distribution | | export_options.provisioningProfiles.country.appName.appNameapp | *** AppStore - Jan 10, 2022 | | export_options.provisioningProfiles.com.clientName.***TST | match AppStore com.clientName.***TST | | export_method | app-store | | clean | false | | output_directory | . | | output_name | *** STG | | silent | false | | skip_package_ipa | false | | skip_package_pkg | false | | build_path | /Users/runner/Library/Developer/Xcode/Archives/2023-12-04 | | result_bundle | false | | buildlog_path | ~/Library/Logs/gym | | destination | generic/platform=iOS | | xcodebuild_formatter | xcpretty | | build_timing_summary | false | | skip_profile_detection | false | | xcodebuild_command | xcodebuild | | skip_package_dependencies_resolution | false | | disable_package_automatic_updates | false | | use_system_scm | false | | xcode_path | /Applications/Xcode_14.3.1.app | +-------------------------------------------------------------+-----------------------------------------------------------+

[01:34:55]: $ set -o pipefail && xcodebuild -workspace .xcworkspace -scheme \ STG -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2023-12-04/\ STG\ 2023-12-04\ 01.34.55.xcarchive archive | tee /Users/runner/Library/Logs/gym/\ STG-\ STG.log | xcpretty [01:34:56]: ▸ 2023-12-04 01:34:56.572 xcodebuild[9290:43687] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [01:35:13]: ▸ 2023-12-04 01:35:13.556 xcodebuild[9290:43687] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x6000011bb300: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/-afhujhumhapxtmgbhchvzeyjrald/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

<Copying - Processing - Compiling - Linking - Warnings>

[01:37:58]: ▸ Generating '\ STG.app.dSYM' [01:38:00]: ▸ Running script 'Run Script' [01:38:03]: ▸ ⚠️ /Users/runner/work/-iOS/-iOS/Tests/Scene Tests/Chat/Initial Inbox Page/InitialInboxPageViewControllerTests.swift:60:11: Comment Spacing Violation: Prefer at least one space after slashes for comments (comment_spacing) [01:38:03]: ▸ Linting 'SessionDetailsPresenterTests.swift' (6/638) [01:38:03]: ▸ ^ [01:38:08]: ▸ Running script '[CP] Embed Pods Frameworks' [01:38:16]: ▸ Touching \ STG.app (in target ' STG' from project '') [01:38:17]: ▸ Archive Succeeded [01:38:17]: Generated plist file with the following values: [01:38:17]: ▸ ----------------------------------------- [01:38:17]: ▸ { [01:38:17]: ▸ "method": "app-store", [01:38:17]: ▸ "provisioningProfiles": { [01:38:17]: ▸ "com.clientName.STG": "STG Distribution", [01:38:17]: ▸ "country.appName.appNameapp": " AppStore - Jan 10, 2022", [01:38:17]: ▸ "com.clientName.TST": "match AppStore com.clientName.TST" [01:38:17]: ▸ }, [01:38:17]: ▸ "signingStyle": "manual" [01:38:17]: ▸ } [01:38:17]: ▸ ----------------------------------------- [01:38:17]: $ /usr/bin/xcrun /Users/runner/work/-iOS/-iOS/vendor/bundle/ruby/3.2.0/gems/fastlane-2.217.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/gym_config20231204-7022-ng4o1a.plist' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2023-12-04/\ STG\ 2023-12-04\ 01.34.55.xcarchive -exportPath '/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/gym_output20231204-7022-tj2wxo' [01:38:40]: Compressing 9 dSYM(s) [01:38:40]: $ cd '/Users/runner/Library/Developer/Xcode/Archives/2023-12-04/ STG 2023-12-04 01.34.55.xcarchive/dSYMs' && zip -r '/Users/runner/work/-iOS/-iOS/*** STG.app.dSYM.zip' .dSYM [01:38:42]: ▸ adding: Alamofire.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: Alamofire.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: Alamofire.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: Alamofire.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: Alamofire.framework.dSYM/Contents/Resources/DWARF/Alamofire (deflated 70%) [01:38:42]: ▸ adding: Alamofire.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/Contents/Resources/DWARF/Connectivity (deflated 60%) [01:38:42]: ▸ adding: Connectivity.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: *** STG.app.dSYM/ (stored 0%) [01:38:42]: ▸ adding: *** STG.app.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: *** STG.app.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: *** STG.app.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: *** STG.app.dSYM/Contents/Resources/DWARF/** STG (deflated 69%) [01:38:42]: ▸ adding: *** STG.app.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/Contents/Resources/DWARF/IQKeyboardManagerSwift (deflated 67%) [01:38:42]: ▸ adding: IQKeyboardManagerSwift.framework.dSYM/Contents/Info.plist (deflated 51%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/Contents/Resources/DWARF/JTAppleCalendar (deflated 66%) [01:38:42]: ▸ adding: JTAppleCalendar.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/Contents/Resources/DWARF/Lottie (deflated 69%) [01:38:42]: ▸ adding: Lottie.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/Contents/Resources/DWARF/PinCodeTextField (deflated 62%) [01:38:42]: ▸ adding: PinCodeTextField.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/Contents/Resources/DWARF/SocketIO (deflated 65%) [01:38:42]: ▸ adding: SocketIO.framework.dSYM/Contents/Info.plist (deflated 52%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/ (stored 0%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/Contents/ (stored 0%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/Contents/Resources/ (stored 0%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/Contents/Resources/DWARF/ (stored 0%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/Contents/Resources/DWARF/Starscream (deflated 64%) [01:38:42]: ▸ adding: Starscream.framework.dSYM/Contents/Info.plist (deflated 52%)

[01:38:42]: Successfully exported and compressed dSYM file [01:38:42]: Successfully exported and signed the ipa file: [01:38:42]: /Users/runner/work/-iOS/-iOS/*** STG.ipa [01:38:42]: Cruising back to lane 'ios build_upload_testflight' 🚘 [01:38:42]: ----------------------------------------------- [01:38:42]: --- Step: Switch to ios upload_release lane --- [01:38:42]: ----------------------------------------------- [01:38:42]: Cruising over to lane 'ios upload_release' 🚖 [01:38:42]: --------------------- [01:38:42]: --- Step: deliver --- [01:38:42]: --------------------- [01:38:42]: Creating authorization token for App Store Connect API

+---------------------------------------------------------------+ | deliver 2.217.0 Summary | +--------------------------------------+------------------------+ | api_key | ******** | | skip_screenshots | true | | skip_metadata | true | | skip_app_version_update | true | | force | true | | run_precheck_before_submit | false | | screenshots_path | ./fastlane/screenshots | | metadata_path | ./fastlane/metadata | | app_version | 2.0.1 | | app_identifier | com.clientName.***STG | | ipa | *** STG.ipa | | platform | ios | | edit_live | false | | use_live_version | false | | skip_binary_upload | false | | overwrite_screenshots | false | | sync_screenshots | false | | submit_for_review | false | | verify_only | false | | reject_if_possible | false | | phased_release | false | | reset_ratings | false | | precheck_default_rule_level | warn | | ignore_language_directory_validation | false | | precheck_include_in_app_purchases | true | +--------------------------------------+------------------------+

[01:38:42]: Uploading binary to App Store Connect [01:38:44]: Going to upload updated app to App Store Connect [01:38:44]: This might take a few minutes. Please don't interrupt the script. 01:38:46: [altool] 2023-12-04 01:38:46.423 *** Error: Unable to upload archive. Failed to authenticate with errors: (

01:38:46: [altool] ) (-1011)

01:38:46: [altool] {

01:38:46: [altool] NSLocalizedDescription = "Unable to upload archive.";

01:38:46: [altool] NSLocalizedFailureReason = "Failed to authenticate with errors: (\n "Error Domain=ITunesConnectionAuthenticationErrorDomain Code=-26000 \"Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_.p8, NSStringEncoding=4}\" UserInfo={NSLocalizedRecoverySuggestion=Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_.p8, NSStringEncoding=4}, NSLocalizedDescription=Failed to generate JWT token: Error Domain=NSCocoaErrorDomain Code=261 \"The file \U201cAuthKey_.p8\U201d couldn\U2019t be opened using text encoding Unicode (UTF-8).\" UserInfo={NSFilePath=/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/deliver-20231204-7022-lxllu8/AuthKey_.p8, NSStringEncoding=4}, NSLocalizedFailureReason=App Store operation failed.}"\n)";

01:38:46: [altool] }

01:38:46: Application Loader output above ^ 01:38:46: Error uploading '/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/6e977970-0c61-468b-8a18-f5bdbf65c337.ipa'.

01:38:46: Unable to upload archive. Failed to authenticate with errors: (

01:38:46: The call to the altool completed with a non-zero exit status: 1. This indicates a failure. 01:38:46: Could not download/upload from App Store Connect! +--------------------------------------------------------------------------------------------------------------------------------------+ | Lane Context | +--------------------------------+-----------------------------------------------------------------------------------------------------+ | DEFAULT_PLATFORM | ios | | PLATFORM_NAME | ios | | LANE_NAME | ios build_upload_testflight | | KEYCHAIN_PATH | ~/Library/Keychains/signing | | ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/login.keychain-db" | | SIGH_PROFILE_PATH | /Users/runner/work/-iOS/-iOS/AppStore_com.clientName.STG.mobileprovision | | SIGH_PROFILE_PATHS | ["/Users/runner/work/-iOS/-iOS/AppStore_com.clientName.STG.mobileprovision"] | | SIGH_UDID | 089c8688-187f-49c6-ac99-d3ca848610d7 | | SIGH_UUID | 089c8688-187f-49c6-ac99-d3ca848610d7 | | SIGH_NAME | STG Distribution | | SIGH_PROFILE_TYPE | app-store | | VERSION_NUMBER | 2.0.1 | | LATEST_TESTFLIGHT_BUILD_NUMBER | 17 | | LATEST_TESTFLIGHT_VERSION | 2.0.1 | | BUILD_NUMBER | 18 | | XCODES_XCODE_PATH | /Applications/Xcode_14.3.1.app/Contents/Developer | | IPA_OUTPUT_PATH | /Users/runner/work/-iOS/-iOS/ STG.ipa | | XCODEBUILD_ARCHIVE | /Users/runner/Library/Developer/Xcode/Archives/2023-12-04/*** STG 2023-12-04 01.34.55.xcarchive | | DSYM_OUTPUT_PATH | /Users/runner/work/-iOS/-iOS/*** STG.app.dSYM.zip | +--------------------------------+-----------------------------------------------------------------------------------------------------+ 01:38:46: Error uploading ipa file: [Application Loader Error Output]: Error uploading '/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/6e977970-0c61-468b-8a18-f5bdbf65c337.ipa'. [Application Loader Error Output]: Unable to upload archive. Failed to authenticate with errors: ( [Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

+--------------------------------------------------------------------------+ | fastlane summary | +------+-----------------------------------------------------+-------------+ | Step | Action | Time (in s) | +------+-----------------------------------------------------+-------------+ | 1 | default_platform | 0 | | 2 | Switch to ios load_asc_api_key lane | 0 | | 3 | app_store_connect_api_key | 0 | | 4 | Switch to ios prepare_signing lane | 0 | | 5 | create_keychain | 0 | | 6 | import_certificate | 0 | | 7 | sigh | 2 | | 8 | Switch to ios fetch_and_increment_build_number lane | 0 | | 9 | get_version_number | 1 | | 10 | latest_testflight_build_number | 0 | | 11 | increment_build_number | 2 | | 12 | Switch to ios build_release lane | 0 | | 13 | update_code_signing_settings | 0 | | 14 | cocoapods | 24 | | 15 | xcodes | 0 | | 16 | gym | 432 | | 17 | Switch to ios upload_release lane | 0 | | 💥 | deliver | 4 | +------+-----------------------------------------------------+-------------+

01:38:46: fastlane finished with errors

[!] Error uploading ipa file: [Application Loader Error Output]: Error uploading '/var/folders/q4/3s60g5510ydbd3qc3p4xflm80000gn/T/6e977970-0c61-468b-8a18-f5bdbf65c337.ipa'. [Application Loader Error Output]: Unable to upload archive. Failed to authenticate with errors: ( [Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure. Error: Process completed with exit code 1.

Environment

✅ fastlane environment ✅

swift-driver version: 1.75.2

Stack

Key Value
OS 13.6
Ruby 3.2.1
Bundler? true
Git git version 2.42.0
Installation Source ~/work/appName-iOS/appName-iOS/vendor/bundle/ruby/3.2.0/bin/fastlane
Host macOS 13.6 (22G120)
Ruby Lib Dir ~/hostedtoolcache/Ruby/3.2.1/x64/lib
OpenSSL Version OpenSSL 3.0.8 7 Feb 2023
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode_14.3.1.app/Contents/Developer/
Xcode Version 14.3.1
Swift Version 5.8.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
default_platform(:ios)

platform :ios do
  # desc "Load AppStore Connect API Key to use in subsequent lanes"
  lane :load_asc_api_key do
     app_store_connect_api_key(
       key_id: ENV["ASC_KEY_ID"],
       issuer_id: ENV["ASC_ISSUER_ID"],
       key_content: ENV["ASC_KEY"],
       is_key_content_base64: true,
       in_house: false # Detecting this via ASC private key is currently not supported
     )
  end

  desc "Bump build number based on the most recent TestFlight build number"
  lane :fetch_and_increment_build_number do
    #fetch read your app identifier defined in your Appfile
    app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    
    current_version = get_version_number(
      target: "appName STG" # replace with your main target, required if you have more than one non-test target
    )
    latest_build_number = latest_testflight_build_number(
      api_key: api_key,
      version: current_version,
      app_identifier: app_identifier
    )
    increment_build_number(
      build_number: (latest_build_number + 1),
    )
  end

  desc "Installs signing certificate in the keychain and downloads provisioning profiles from the App Store Connect"
  lane :prepare_signing do |options|
    team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
    api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    
    keychain_name = "signing"
    keychain_password = "temp"
    
    delete_keychain(
      name: keychain_name
    ) if File.exist? File.expand_path("~/Library/Keychains/#{keychain_name}-db")
    
    create_keychain(
      name: keychain_name,
      password: keychain_password,
      default_keychain: true,
      unlock: true,
      timeout: 3600
    )
    
    import_certificate(
      certificate_path: ENV["SIGNING_KEY_FILE_PATH"],
      certificate_password: ENV["SIGNING_KEY_PASSWORD"],
      keychain_name: keychain_name,
      keychain_password: keychain_password
    )
   
    # fetches and installs provisioning profiles from ASC    
    sigh(
      api_key: api_key,
      readonly: true
    )
  end
  
  desc "Build the iOS app for release"
  lane :build_release do |options|
    app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    
    profile_name = "appNameSTG Distribution"
    export_method = "app-store"
    
    # turn off automatic signing during build so correct code signing identity is guaranteed to be used
    update_code_signing_settings(
      use_automatic_signing: false,
      targets: ["appName STG"],
      code_sign_identity: "Apple Distribution",
      bundle_identifier: app_identifier,
      profile_name: profile_name,
      build_configurations: ["Release"]
    )
    
    # install Pods
    cocoapods(
      clean_install: true
    )
        
    # Specify the Xcode version
    xcodes(
      version: "14.3.1",
      select_for_current_build_only: true
    )
    
    # build the app
    gym(
      scheme: "appName STG",
      workspace: "appName.xcworkspace",
      configuration: "Release",
      export_options: {
        method: export_method,
        provisioningProfiles: {
          app_identifier => profile_name
        }
      }
    )
  end

  desc "Upload to TestFlight / AppStore Connect"
  lane :upload_release do
    api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    
    deliver(
      api_key: api_key,
      skip_screenshots: true,
      skip_metadata: true,
      skip_app_version_update: true,
      force: true, # skips verification of HTML preview file (since this will be run from a CI machine)
     run_precheck_before_submit: false # not supported through ASC API yet
    )
  end
  
  desc "Build and upload to TestFlight"
  lane :build_upload_testflight do
    load_asc_api_key
    prepare_signing
    fetch_and_increment_build_number
    build_release
    upload_release
   end
end

`./fastlane/Appfile`
app_identifier("com.clientName.appNameSTG") # The bundle identifier of the staging app
# apple_id("[[APPLE_ID]]") # Your Apple email address


# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.217.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
error_highlight 0.5.1
did_you_mean 1.6.3
syntax_suggest 1.0.2
bundler 2.4.10
pathname 0.2.1
rake 13.1.0
rexml 3.2.6
CFPropertyList 3.0.6
base64 0.2.0
bigdecimal 3.1.4
concurrent-ruby 1.2.2
connection_pool 2.4.1
ruby2_keywords 0.0.5
drb 2.2.0
i18n 1.14.1
minitest 5.20.0
mutex_m 0.2.0
tzinfo 2.0.6
activesupport 7.1.2
public_suffix 4.0.7
addressable 2.8.5
httpclient 2.8.3
json 2.6.3
algoliasearch 1.27.5
artifactory 3.0.15
atomos 0.1.3
aws-eventstream 1.3.0
aws-partitions 1.856.0
aws-sigv4 1.7.0
jmespath 1.6.2
aws-sdk-core 3.188.0
aws-sdk-kms 1.73.0
aws-sdk-s3 1.139.0
babosa 1.0.4
claide 1.1.0
fuzzy_match 2.0.4
nap 1.1.0
netrc 0.11.0
ffi 1.16.3
ethon 0.16.0
typhoeus 1.4.1
cocoapods-core 1.14.2
cocoapods-deintegrate 1.0.5
cocoapods-downloader 2.1
cocoapods-plugins 1.0.0
cocoapods-search 1.0.1
cocoapods-trunk 1.6.0
cocoapods-try 1.2.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.3.1
gh_inspector 1.1.3
molinillo 0.8.0
ruby-macho 2.5.1
nanaimo 0.3.0
xcodeproj 1.23.0
cocoapods 1.14.2
colored 1.2
highline 2.0.3
commander 4.6.0
declarative 0.0.20
digest-crc 0.6.5
domain_name 0.6.20231109
dotenv 2.8.1
emoji_regex 3.2.3
excon 0.104.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
multipart-post 2.3.0
faraday-multipart 1.0.4
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
faraday 1.10.3
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.7
jwt 2.7.1
multi_json 1.15.0
os 1.1.4
signet 0.18.0
googleauth 1.8.1
mini_mime 1.1.5
trailblazer-option 0.1.2
uber 0.1.0
representable 3.2.0
retriable 3.1.2
webrick 1.8.1
google-apis-core 0.11.2
google-apis-androidpublisher_v3 0.53.0
google-apis-playcustomapp_v1 0.13.0
google-apis-iamcredentials_v1 0.17.0
google-apis-storage_v1 0.29.0
google-cloud-env 1.6.0
google-cloud-errors 1.3.1
google-cloud-core 1.6.0
google-cloud-storage 1.45.0
mini_magick 4.12.0
naturally 2.2.1
optparse 0.1.1
plist 3.7.0
rubyzip 2.3.2
security 0.1.3
simctl 1.6.10
terminal-notifier 2.0.0
unicode-display_width 2.5.0
terminal-table 3.0.2
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.1

generated on: 2023-12-04

AfsarFresh avatar Dec 04 '23 20:12 AfsarFresh

I'm still facing issues with the deliver action failing to upload builds to TestFlight. Could someone provide guidance on resolving this? Your help is much appreciated.

AfsarFresh avatar Dec 13 '23 19:12 AfsarFresh

I'm stuck with the issue. Do you need any additional information to assist with resolving this?

AfsarFresh avatar Dec 22 '23 17:12 AfsarFresh

I wanted to bring your attention back to this issue I opened on Dec 4, 2023. Unfortunately, we haven't had any responses yet.

I understand everyone's busy, but if you could spare a moment, your insights would be incredibly valuable. I'm reaching out to the following contributors for their expertise:

  1. @joshdholtz
  2. @giginet
  3. @AliSoftware
  4. @KrauseFx

Your help would mean a lot!

AfsarFresh avatar Jan 18 '24 18:01 AfsarFresh

Sorry, I haven’t got notice for while. I’ll watch this problem. Please moment.

giginet avatar Jan 21 '24 21:01 giginet

Hi @giginet, Thanks for your response! Any updates or insights on the issue from your end? Your input would be invaluable. Appreciate your help!

AfsarFresh avatar Feb 11 '24 17:02 AfsarFresh

Hello, the error in the log is

JWT token: Error Domain=NSCocoaErrorDomain Code=261 "The file U201cAuthKey_***.p8U201d couldnU2019t be opened using text encoding Unicode (UTF-8)

I suspect your p8 file is incorrectly encoded. Questions: Are you sure the content of ASC_KEY is base64 encoded? Have you tried with is_key_content_base64: false

lacostej avatar Feb 23 '24 09:02 lacostej