Search code examples
iosapp-storearchivetestflightfastlane

Fastlane failed while uploading to TestFlight


I have a simple fastlane command like below.

  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_app(workspace: "Project.xcworkspace", scheme: "Project")
    upload_to_testflight
  end

It finished the archive successfully. But crashed during the upload process with the following log:

[11:24:38]: ▸ ** ARCHIVE SUCCEEDED **
[11:24:38]: 
[11:24:38]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[11:24:38]: 📋  For the complete and more detailed error log, check the full log at:
[11:24:38]: 📋  /Users/user/Library/Logs/gym/project.log
[11:24:38]: 
[11:24:38]: Looks like fastlane ran into a build/archive error with your project
[11:24:38]: It's hard to tell what's causing the error, so we wrote some guides on how
[11:24:38]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[11:24:38]: Before submitting an issue on GitHub, please follow the guide above and make
[11:24:38]: sure your project is set up correctly.
[11:24:38]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[11:24:38]: the full commands printed out in yellow in the above log.
[11:24:38]: Make sure to inspect the output above, as usually you'll find more error information there
[11:24:38]: 
[11:24:38]: Looks like no provisioning profile mapping was provided
[11:24:38]: Please check the complete output, in particular the very top
[11:24:38]: and see if you can find more information. You can also run fastlane
[11:24:38]: with the `--verbose` flag.
[11:24:38]: Alternatively you can provide the provisioning profile mapping manually
[11:24:38]: https://docs.fastlane.tools/codesigning/xcode-project/#xcode-9-and-up
+------------------+-----------+
|         Lane Context         |
+------------------+-----------+
| DEFAULT_PLATFORM | ios       |
| PLATFORM_NAME    | ios       |
| LANE_NAME        | ios tests |
| BUILD_NUMBER     | 4         |
+------------------+-----------+
[11:24:38]: Error packaging up the application

+------+------------------------+-------------+
|              fastlane summary               |
+------+------------------------+-------------+
| Step | Action                 | Time (in s) |
+------+------------------------+-------------+
| 1    | default_platform       | 0           |
| 2    | increment_build_number | 2           |
| 💥   | build_app              | 742         |
+------+------------------------+-------------+

[11:24:38]: fastlane finished with errors

[!] Error packaging up the application


Solution

  • I realized that when I try to upload the app manually, Xcode throws an exception related to permissions. My current profile has a developer role, and validating and uploading to TestFlight requires an admin role. I changed the profile and Fastlane is successfully finished.