EAS Build Fastlane Error - Provisioning Profiles

Hi,

My eas build is failing with a fastlane error:

There seems to be a mismatch between your provided `export_method` in gym
and the selected provisioning profiles. You passed the following options:
  export_method:      
  Bundle identifier:  com.payright.customer
  Profile name:       *[expo] com.payright.customer.uat AppStore 2021-04-30T00:35:38.109Z
  Profile type:       app-store
Make sure to either change the `export_method` passed from your Fastfile or CLI
or select the correct provisioning profiles by updating your Xcode project
or passing the profiles to use by using match or manually via the `export_options` hash

Looking at the full logs it looks like there are 2 provisioning profiles attached to the project, is that the cause of the error, and how do i only associate 1 profile to this project?

Creating Gymfile
Gymfile created
Successfully loaded '/Users/expo/workingdir/build/ios/Gymfile' đź“„
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                  Detected Values from './Gymfile'                                                                   |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| suppress_xcode_output | true                                                                                                                                        |
| clean                 | false                                                                                                                                       |
| scheme                | UAT                                                                                                                                         |
| configuration         | Release                                                                                                                                     |
| export_options        |                                                                                                                                             |
| export_xcargs         | OTHER_CODE_SIGN_FLAGS="--keychain /var/folders/97/73j93h690g9gdn54bh_zskm40000gn/T/turtle-v2-fe281f5d-7274-448e-8f36-7080f4309e48.keychain" |
| disable_xcpretty      | true                                                                                                                                        |
| output_directory      | ./build                                                                                                                                     |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
Resolving Swift Package Manager dependencies...
$ xcodebuild -resolvePackageDependencies -workspace ./Payright.xcworkspace -scheme UAT -configuration Release
â–¸ Command line invocation:
â–¸     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ./Payright.xcworkspace -scheme UAT -configuration Release
â–¸ resolved source packages:
$ xcodebuild -showBuildSettings -workspace ./Payright.xcworkspace -scheme UAT -configuration Release
Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
Detected provisioning profile mapping: {:"com.payright.customer.uat"=>"0976a128-93cd-46fb-95a3-8c1f352b81d9", :"com.payright.customer"=>"*[expo] com.payright.customer.uat AppStore 2021-04-30T00:35:38.109Z"}
+---------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                           Summary for gym 2.178.0                                                                                           |
+---------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| workspace                                                     | ./Payright.xcworkspace                                                                                                                      |
| scheme                                                        | UAT                                                                                                                                         |
| clean                                                         | false                                                                                                                                       |
| output_directory                                              | ./build                                                                                                                                     |
| output_name                                                   | Payright                                                                                                                                    |
| configuration                                                 | Release                                                                                                                                     |
| silent                                                        | false                                                                                                                                       |
| skip_package_ipa                                              | false                                                                                                                                       |
| skip_package_pkg                                              | false                                                                                                                                       |
| export_options.method                                         | app-store                                                                                                                                   |
| export_options.provisioningProfiles.com.payright.customer.uat | 0976a128-93cd-46fb-95a3-8c1f352b81d9                                                                                                        |
| export_options.provisioningProfiles.com.payright.customer     | *[expo] com.payright.customer.uat AppStore 2021-04-30T00:35:38.109Z                                                                         |
| export_xcargs                                                 | OTHER_CODE_SIGN_FLAGS="--keychain /var/folders/97/73j93h690g9gdn54bh_zskm40000gn/T/turtle-v2-fe281f5d-7274-448e-8f36-7080f4309e48.keychain" |
| build_path                                                    | /Users/expo/Library/Developer/Xcode/Archives/2021-04-29                                                                                     |
| result_bundle                                                 | false                                                                                                                                       |
| buildlog_path                                                 | ~/Library/Logs/gym                                                                                                                          |
| destination                                                   | generic/platform=iOS                                                                                                                        |
| suppress_xcode_output                                         | true                                                                                                                                        |
| disable_xcpretty                                              | true                                                                                                                                        |
| skip_profile_detection                                        | false                                                                                                                                       |
| skip_package_dependencies_resolution                          | false                                                                                                                                       |
| disable_package_automatic_updates                             | false                                                                                                                                       |
| use_system_scm                                                | false                                                                                                                                       |
| xcode_path                                                    | /Applications/Xcode.app                                                                                                                     |
+---------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
$ set -o pipefail && xcodebuild -workspace ./Payright.xcworkspace -scheme UAT -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/expo/Library/Developer/Xcode/Archives/2021-04-29/Payright\ 2021-04-29\ 17.49.52.xcarchive archive | tee /Users/expo/Library/Logs/gym/Payright-UAT.log > /dev/null
â–¸ ** ARCHIVE FAILED **
** ARCHIVE FAILED **
Exit status: 65
+-------------+-------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.178.0                 |
| sdk         | iPhoneOS14.4.sdk        |
+-------------+-------------------------+
There seems to be a mismatch between your provided `export_method` in gym
and the selected provisioning profiles. You passed the following options:
  export_method:      
  Bundle identifier:  com.payright.customer
  Profile name:       *[expo] com.payright.customer.uat AppStore 2021-04-30T00:35:38.109Z
  Profile type:       app-store
Make sure to either change the `export_method` passed from your Fastfile or CLI
or select the correct provisioning profiles by updating your Xcode project
or passing the profiles to use by using match or manually via the `export_options` hash
Looks like fastlane ran into a build/archive error with your project
It's hard to tell what's causing the error, so we wrote some guides on how
to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
Before submitting an issue on GitHub, please follow the guide above and make
sure your project is set up correctly.
fastlane uses `xcodebuild` commands to generate your binary, you can see the
the full commands printed out in yellow in the above log.
Make sure to inspect the output above, as usually you'll find more error information there
[stderr] [!] Error building the application - see the log above
Error: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.

Regards,

Praveen

just glanced at this but it seems like maybe you’re providing a provisioning profile that doesn’t match the project

notice the bundle ids don’t match

@notbrent I think the issue is that my other schemes have configuration that is not “Debug” or “Release”. They are called “UAT.Debug” and “UAT.Release” for example. Fastlane is using the right scheme, but the wrong configuration, on the “Release” configuration I have the bundleId “com.payright.customer”. It seems I cannot provide the “UAT.Release” configuration to the eas.json as it only accepts “Debug”, “Release”, or “Auto”.

Is there a way around this? Should i be using “Auto”?

Yes and make sure that the correct build configuration is specified in scheme. We are changing this value to Release by default because a lot of users had problems if their projects were configured to run Debug builds by default. I’m adding this issue to our internal issue tracking, most likely the change we will go for is to allow any strings in that field and default behaviour will be the same as the current “Auto” option.

@wkozyra

After trying “Auto”, I am getting this error, that the scheme cannot be found even though it exists and is shared:

Creating Gymfile
Gymfile created
Successfully loaded '/Users/expo/workingdir/build/ios/Gymfile' đź“„
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                  Detected Values from './Gymfile'                                                                   |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| suppress_xcode_output | true                                                                                                                                        |
| clean                 | false                                                                                                                                       |
| scheme                | UAT                                                                                                                                         |
| export_options        |                                                                                                                                             |
| export_xcargs         | OTHER_CODE_SIGN_FLAGS="--keychain /var/folders/97/73j93h690g9gdn54bh_zskm40000gn/T/turtle-v2-824f2bf7-7bae-4750-8a61-50f4b7cfca90.keychain" |
| disable_xcpretty      | true                                                                                                                                        |
| output_directory      | ./build                                                                                                                                     |
+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
Couldn't find specified scheme 'UAT'. Please make sure that the scheme is shared, see https://developer.apple.com/library/content/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/ConfigureBots.html#//apple_ref/doc/uid/TP40013292-CH9-SW3
Resolving Swift Package Manager dependencies...
$ xcodebuild -resolvePackageDependencies -workspace ./Payright.xcworkspace -scheme UAT
â–¸ Command line invocation:
â–¸     /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ./Payright.xcworkspace -scheme UAT
â–¸ xcodebuild: error: The workspace named "Payright" does not contain a scheme named "UAT". The "-list" option can be used to find the names of the schemes in the workspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ./Payright.xcworkspace -scheme UAT
xcodebuild: error: The workspace named "Payright" does not contain a scheme named "UAT". The "-list" option can be used to find the names of the schemes in the workspace.
Exit status: 65
[stderr] [!] Exit status: 65
Error: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.

If i run xcodebuild -list

    Build Configurations:
        Debug
        UAT.Debug
        DEV.Debug
        Release
        UAT.Release
        DEV.Release

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        DEV
        Payright
        UAT

my eas.json:

    "ios": {
      "develop": {
        "workflow": "generic",
        "releaseChannel": "develop",
        "scheme": "DEV",
        "schemeBuildConfiguration": "Auto"
      },
      "uat": {
        "workflow": "generic",
        "releaseChannel": "uat",
        "scheme": "UAT",
        "schemeBuildConfiguration": "Auto"
      },
      "release": {
        "workflow": "generic",
        "releaseChannel": "production-1.1.1",
        "scheme": "Payright",
        "schemeBuildConfiguration": "Auto"
      },
      "team": {
        "workflow": "generic",
        "releaseChannel": "default",
        "distribution": "internal"
      }
    }

Any idea what else I could try?

could you share a project that reproduces your same project setup so we can try to understand the situation better?

Hi,

@notbrent @wkozyra

Looks like my local setup had some corrupted scheme or workspace settings, I’m not exactly sure what, but reverted to a previous branch that was working and that has fixed that issue of picking up the UAT scheme.

I have been able to run a successful build using the scheme “UAT”, and schemeBuildConfiguration “Auto”.

As my build configuration is called “UAT.Release”, under the “Auto” setting is it guaranteed that the build would be of this type and not a debug version, as I also have a “UAT.Debug”. I could not see anywhere in the fastlane logs that “UAT.Release” was chosen.

I just want to confirm this before deploying it to the App Store.

Regards,

Praveen