EAS build fails for iOS: wrong bundle ID

managed
eas-cli 3.15.1

  1. I have used command eas credentials, deleted old Distribution Certificate and Provisioning Profiles.
  2. Create new build I let eas create required apple setup.
  3. eas build -p ios --profile production
    Log in to Apple Developer account>

    :heavy_check_mark: Logged in Local session
    :heavy_check_mark: Bundle identifier registered **** (<This is correct, just written here for example)

    Provisioning profile (id: ****) does not exist in Apple Developer Portal
    :heavy_check_mark: Select devices for the ad hoc build: » 2 devices selected
    :heavy_check_mark: Created new profile: ****

Project Credentials Configuration

Project ****
Bundle Identifier **** (<This is correct)

Result in Build Details > Run fastlane:

+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+

|                                                                                         Summary for gym 2.213.0                                                                                          |

+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+

| workspace                                                  | ./example.xcworkspace                                                                                                                         |

| scheme                                                     | example                                                                                                                                       |

| clean                                                      | false                                                                                                                                       |

| output_directory                                           | ./build                                                                                                                                     |

| output_name                                                | example                                                                                                                                       |

| configuration                                              | Release                                                                                                                                     |

| silent                                                     | false                                                                                                                                       |

| skip_package_ipa                                           | false                                                                                                                                       |

| skip_package_pkg                                           | false                                                                                                                                       |

| export_options.method                                      | ad-hoc                                                                                                                                      |

<<CORRECT>>
| export_options.provisioningProfiles.com.example.production | correct apple UID                                                                                                 |

<<WRONG, this does not exist neither in eas credentials or app developer portal >>
| export_options.provisioningProfiles.com.example.development| *[expo] com.example.production AdHoc 168...                                                                                          |

| export_xcargs                                              | OTHER_CODE_SIGN_FLAGS="" |

| build_path                                                 | /Users/expo/Library/Developer/Xcode/Archives/2023-07-18                                                                                     |

| result_bundle                                              | false                                                                                                                                       |

| buildlog_path                                              | /Users/expo/workingdir/logs                                                                                                                 |

| destination                                                | generic/platform=iOS                                                                                                                        |

| suppress_xcode_output                                      | true                                                                                                                                        |

| xcodebuild_formatter                                       | xcpretty                                                                                                                                    |

| build_timing_summary                                       | false                                                                                                                                       |

| disable_xcpretty                                           | true                                                                                                                                        |

| 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.app                                                                                                                     |

+------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+

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.example.development (<This is wrong and the build fails every time. Why and how?)
Profile name:       *[expo] com.example.production AdHoc 168..
Profile type:       ad-hoc

Xcode logs shows error:

 Provisioning profile "*[expo] com.example.production AdHoc 168.." has app ID "com.example.production", which does not match the bundle ID "com.example.development". (in target 'example' from project 'example')

Any help is greatly appreciated. And please do help if you have any clue or possible advancement on this issue. It is preventing me from building iOS apps at the moment. I have used almost all of my free builds for this month trying to solve this trying different configurations

-Best regards, Kehitys

Could you send me the URL of your build?

1 Like

Yes of course:
-removed link

Are you using a dynamic app config (app.config.js) or a static one (app.json)?

1 Like

Dynamic.
(Edit: I believe as Expo build shows values from app config in Read app config step, that those should be correct)

Could you try to create a new ad-hoc provisioning profile in cli running it with the EXPO_DEBUG=1 flag to see more detailed logs?

1 Like

Yes, I will do it right away and post result here as it is done

Edit:
Question: how do you create new ad-hoc profile in cli? Is it through running eas build command with EXPO_DEBUG=1 flag?

I think that here you can see all the docs about internal distribution Internal distribution - Expo Documentation

1 Like

EXPO_DEBUG=1 just prints additional logs

1 Like

Your intention is to create an internal distribution build, not App Store one, right?

I’m asking, because I see that your build was created using the production profile. It doesn’t really matter, but people usually put their App Store distribution configuration there and I want to make sure that you wanted to use it for internal :smile:

1 Like

Yes. And yes, this was specifically made with production profile and set to be distributed internally, wanting to test the real environment.

I tried to run build as it described in the document you provided (as build --profile etc), but no additional logs were given. I’m running Windows and set EXPO_DEBUG=1 or set EXPO_DEBUG=1 true throws: Error: GetEnv.NoBoolean: 1 is not a boolean. Using cross-env then to change EXPO_DEBUG went through but didn’t result any additional logs to be shown in making the profile. At least prior to actually making it to the build. Should I let it go there? (as I have 2 builds left for the month)

Edit: maybe I should make the development build as it will create the actual profile for it and then make production build and hope it then doensn’t fetch both the dev and prod profiles :thinking: :man_shrugging:

Edit 2: I will try now creating new profile with development environment and EXPO_DEBUG=1 flag. I maybe need to go over free tier but then it goes over.
I will need to leave now as my dear wife is waiting for me with the car. Will continue to investigate this tomorrow. Thank you really much already @szdziedzic and have a wonderful day sir!

No the same problem is still happening. I made successful build for development. I made a new project for staging and then sharing in staging profile but still it fails due importing wrong provisioning profile.

Successful builds shows Run fastlane line 32 as:
Detected provisioning profile mapping: {:"com.example.development"=>"num"}

And the failing as:
Detected provisioning profile mapping: {:"com.example.staging"=>"num", :"com.example.development"=>"*[expo] com.example.staging AdHoc num"}

Somehow then it uses the second and the build fails

I’m now paying customer so I believe the development team will help me through this. :blush: :+1:

1 Like

Got it working. But the main reason for the error I don’t know

Base:
I used .env.development and .env.production. But as they don’t work for EAS build I had the values in eas.json. In app.config.ts then I checked EXPO_PUBLIC_APP_ENV (which I made to define the slug, scheme etc. in app.config.ts) to define values in there.

The result:
In EAS build step Read app config everything was correct. But(!) when it came to Run fastlane somehow this EXPO_PUBLIC_APP_ENV was undefined and resulted in wrong values in app.config.ts. I don’t know how this is possible and as far as I know env values in eas.json should work in EAS build, but on that specified step env values defined in eas.json seem to undefined

Solution:
define EXPO_PUBLIC_APP_ENV manually in app.config.ts

This was a hassle. I know how to reproduce this now so I will make steps to do it and make and issue so that others won’t come to this and can find solution.

Hi,

It’s great to hear that you got it working :smile:. I’m not sure how this could be possible :thinking:. Could you paste your eas.json (or this specific profile that you used) here (of course without any sensitive information)?

Sure:

{
  "cli": {
    "version": ">= 3.16.0",
    "promptToConfigurePushNotifications": false
  },
  "build": {
    "development": {
      "channel": "development",
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "staging": {
      "channel": "staging",
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      },
      "env": {
        "EXPO_PUBLIC_API_KEY": "",
        "EXPO_PUBLIC_AUTH_DOMAIN": "",
        "EXPO_PUBLIC_PROJECT_ID": "",
        "EXPO_PUBLIC_STORAGE_BUCKET": "",
        "EXPO_PUBLIC_MESSAGING_SENDER_ID": "",
        "EXPO_PUBLIC_APP_ID": "",
        "EXPO_PUBLIC_MEASUREMENT_ID": "",
        "EXPO_PUBLIC_MAPS_API_KEY": "",
        "EXPO_PUBLIC_ANDROID_MAPS_API_KEY": "",
        "EXPO_PUBLIC_IOS_MAPS_API_KEY": "",
        "EXPO_PUBLIC_SENTRY_ORGANIZATION": "",
        "EXPO_PUBLIC_SENTRY_PROJECT": "",
        "EXPO_PUBLIC_APP_ENV": "production"
      }
    },
    "production": {
      "channel": "production"
    }
  },
  "submit": {
    "production": {}
  }
}

Emptied other env values than EXPO_PUBLIC_APP_ENV for this reply. I use “development” or “production” in APP_ENV to pick the desired slug, scheme and some environment specific functionality in the app. There should not be anything uncommon

I even noticed that if I didn’t define EXPO_PUBLIC_APP_ENV in app.config.ts when making android build that 1. app config was read correctly 2. package (com.example.production) was correct, 3. but package when sending Sentry source maps to sentry was incorrect (com.example.development) in Run gradlew step. The build still succeeded but the build failed for the same reason always for iOS

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.