EAS build "ios.bundleIdentifier" is not defined

  • Whether you are bare or managed workflow
    managed

  • Your eas-cli version
    3.0.0

Expo 47

  • What you have tried so far

I have an Expo managed project I have been working on and testing with the command expo start with no problem. But I am trying to move to EAS to begin preparing to make this a real app.

I have followed the documentation:

npm install -g eas-cli
eas login
eas whoami shows my username

Currently my eas.json file looks like this.

{
  "cli": {
    "version": ">= 3.0.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"

    },
    "preview": {
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

app.config.js

module.exports = {
  name: [AppName],
  version: '2.0.0',
  extra: {
    VIMEO_TOKEN: process.env.VIMEO_TOKEN,
    [..more envVars here]
    eas: {
      "projectId": [projectId]
    }
  },
};

When I run eas build I am greeted with this:
Error: “ios.bundleIdentifier” is not defined in your app.config.js and we can’t update this file
programmatically. Add the value on your own and run this command again.

I am passing in variables to the build like so:
VIMEO_TOKEN=$vimeoToken eas build -p ios --profile review

But I don’t think passing the envVars into the command has anything to do with my issue. I have not found much about this on searching in google or in the EAS/Expo documentation.

Anyone have any idea what is going wrong? This is just an attempt to test eas build.

it looks like your app.config.js does not have a bundle identifier in it, based on what you shared

How would I know what to put in that spot? Do I have to register the app with apple before testing builds with eas?

you will be prompted to enter the bundle identifier when you run eas build. if that isn’t happening, then you may have an ios directory in your project, although it’s unclear to me why that wouldn’t be uploaded. can you share your project on github? it seems you have quite a strange configuration

also, the env var you are setting is wrong: Environment variables and secrets - Expo Documentation

Thank for helping me out.

I started over the eas build:configure process from scratch again and while walking through it, the prompt allowed me to choose the bundle identifier name. Then I was able to pull it out of the app.json file and put it into the app.config.json file. This did get rid of that error I think.

This is how it looks in the app.config.json


module.exports = {
  name: 'kosmique',
  ios:{
    bundleIdentifier:"[com.etc.etc]"
  },
... etc

But now receiving weird error:


TypeError: _configPlugins(...).BaseMods.provider is not a function

Still I believe that at least this issue is resolved.

On your second comment about the environment variables. I got the information from the same link you sent.

I followed this pattern

export default () => ({
  expo: {
    extra: {
      API_URL: process.env.API_URL || null,
    },
    // ...
  },
});

and when running a local setup

API_URL="http://localhost:3000" expo start

when running the project locally with both secrets and not-so-secret envVars.

This works perfectly fine and has been great.

API_URL="https://prod.example.com" eas update --branch production

So I assume that I can do the same can be done like this:

API_URL="https://prod.example.com" eas build --profile preview

But with my current error, I can’t test this at the moment.

Where things get messy as far as I can figure out so far is that I need different secrets for different environments and currently that is why I am trying to pass them in this way because I don’t know how to retrieve the secrets in the app.config.js based on the environment.
??

Unfortunately I can’t share this repo. But do you have an example where this is working for you?

a screenshot from the link that i shared:

you need to set environment variables that will be used on eas build workers inside of the build profile


share your project or a minimal reproducible example of the issue you are encountering. it’s not possible to understand what is happening without being able to see the code

I’ll try to create a very simple example and thanks again for the help.

Hi, brents. I think you missed that he has an app.config.js and he did say:

siasjustin: Normally eas build:configure prompts for and adds android.package / ios.bundleIdentifier to app.json. But if you have converted to using JavaScript (e.g. app.config.js) then it’s impossible for it to know how to add them. But I see you’ve resolved that issue now.

About the environment variables: If you set environment variables locally like this:

then they will be available to the locally running eas command, but will not carry over to the build server. So you will need to define them in eas.json in order for the build server to see them. Generally you’ll need them both locally and in eas.json so that your app.config.js file does the right thing locally and also so that the build server can set them there when running the build.

1 Like

Some of the env vars I am passing through need to be secrets. As such, do I still need to add them to the eas.json file or will they be picked up by eas since they are already created as secrets?

For clarification on this thread, the solution to the ios.bundleIdentifier is not defined issue for me has nothing to do with environment variables. it is just that because I had already created an app.config.js file, eas was not able to add the bundle identifier to the js file. But I was able to copy it from the app.json file from before. It is created when you run eas build as @brents mentioned.

However, After some testing I can say as to the other part of this thread, if you are using secrets to store your environment variables, they do not need to be in the eas.json file. Per the docs and confirmed, the eas secrets override the settings in the eas.json file even if they are there. So it seems ok to not have these in your eas.json file if you are storing them as secrets.

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