eas build fails for iOS because of bundleIdentifier, when there is in fact a bundleIdentifier

Hey, I get this error in preBuild whenever am trying to build with eas build

Your project must have a `bundleIdentifier` set in the Expo config (app.json or app.config.js).

I am on the managed workflow, and have researched about this problem but none seems to be the solution.

The “bundleIdentifier” is sitting right there in my app.json but it seems only the eas cli doesn’t see it somehow, because when I run expo build:ios everything works fine.

From previous similar situations, they had duplicates of the ios object in their app.json, but I have cross-checked mine and it isn’t there.

But I do have a file that has almost everything my app.json has but it is not named app.json rather it is named the-way-app.json-was.json

This is my app.json without the credentials:

{
  "expo": {
    "name": "LionTaxi",
    "slug": "LionTaxi",
    "version": "1.1.2",
    "orientation": "portrait",
    "icon": "./assets/logo/liontaxi.png",
    "splash": {
      "image": "./assets/taxiSplash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "notification": {
      "icon": "./assets/liontaxi.png",
      "iosDisplayInForeground": true
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.emmalion.liontaxi",
      "buildNumber": "1.1.2",
      "config": {
        "googleMapsApiKey": ""
      }
    },
    "web": {
      "favicon": "./assets/liontaxi.png"
    },
    "plugins": ["sentry-expo"],
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "magonner-llc",
            "project": "liontaxi",
            "authToken": ""
          }
        }
      ]
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/liontaxi.png",
        "backgroundColor": "#FFFFFF"
      },
      "package": "com.emmalion.liontaxi",
      "versionCode": 3,
      "googleServicesFile": "./google-services.json",
      "config": {
        "googleMaps": { "apiKey": "" }
      },
      "permissions": [
        "ACCESS_COARSE_LOCATION",
        "ACCESS_FINE_LOCATION",
        "CAMERA"
      ]
    }
  }
}

Please help

--config flag in expo-cli is deprecated, but should still work, in eas-cli it was never supported. You need to name that file app.json/app.config.js. If you have multiple configurations you want to have in a separate file you can create one app.config.js and import or read appropriate sth-else.json files e.g. based on some env variable

to add to @wkozyra’s comment, you can refer to this guide for migrating from --config to app.config.js if you use multiple configurations

Thanks for your response

I am not actually using multiple configurations. I am only using app.json, the other one is just app.json without the credentials (for pushing to github).

And I don’t fully get your point, do you want me to use the configurations in app.config.js or stick to using app.json

I think your mention of the other version of app.json lead them to believe you were using multiple configs and that you were probably switching between them using thd --config option.

If you’re not doing that then the other file is not relevant. There’s no need for you to switch to app.config.js.

What does your bundle ID look like? Does it have any non-letter/digit characters in it besides “-” and “.”?

Ok thanks for the res.

I have deleted the other *.json file and still didn’t work.

My bundleId is com.emmalion.liontaxi, nothing else

If you clone your git repository to somewhere else, does the resulting app.json contain the bundle id? Also what versions of expo-cli and eas-cli do you have installed?

And what does your eas.json contain?

the app.json is ignored in git, and definitely wouldn’t show up in a clone, or am I not supposed to have ignored it?

Expo-cli: 4.10.0
eas-clie: 0.45.1
additional info: win32-x64 node-v16.10.0

{
  "cli": {
    "version": ">= 0.45.1"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

I haven’t changed anything at all

Try upgrading eas-cli and expo-cli and set the requireCommit option in eas.json to false for good measure:

  "cli": {
    "version": "SEMVER_RANGE",
    "requireCommit": boolean
  },

See Configuring EAS Submit with eas.json - Expo Documentation

It’s the Submit page, but the Build page doesn’t seem to mention that option.

See also Android build process - Expo Documentation

And fyi/eas-vcs-workflow.md at main · expo/fyi · GitHub

Thanks for the link you shared. I saw in fyi that eas works with .gitignore.

So I simply removed my app.json from .gitignore and it was able to go past pre-build.

But there is a new error with fastlane, I will do my research on that error now.

Thanks.

1 Like

By the way, if you want to keep something out of git you could switch to app.config.js and use environment variables (and EAS secrets) for the sensitive info.

Then you can commit app.config.js to git without having the sensitive stuff in the repository.

1 Like

Ok thanks. Will do

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