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