Closed onkardeol closed 9 months ago
I am also struggling with this issue. Eas build uses eas.json to create the env variables but for eas updates I can't seem to get it to use env.staging or env.development. It just defaults to whats in env.production.
@onkardeol Have you tried adding NODE_ENV=development
before the eas update
command? It may not be the nicest solution, but it seems to work for me (only locally, though).
Hi all! The eas.json
build profile does not relate to the "standard dotenv" environments. Dotenv is based on NODE_ENV
, and autoselects the right .env.*
files based on dotenv-rails
conventions. The eas.json
build profile names do not overlap with this concept.
In eas.json
, you can define a set of environment variables you want for that specific build through the env
property. If these environment variables contain semi-secret strings, I would recommend using EAS Secrets.
⚠️ Keep in mind that if you use the secret in your app, it's always compiled into the binary. Do not use secret credentials or tokens directly in your app, use an API in between instead.
We still need a better story about how these two mechanisms relate; feel free to open suggestions on our docs at github.com/expo/expo if you have a good idea.
For now I'll close this issue as this repository will be archived soon. Hope this helps!
@byCedric Looks like secrets are not loading when i use pnpx eas-cli update --branch preview --message \"update try\"
I have secrets set.
then on preview i tried
<Pressable
onPress={() => {
Alert.alert("", JSON.stringify(process.env));
}}
>
This is all there is
Oh. I did not see issue wa closed. opening new one https://github.com/expo/eas-cli/issues/2170
Summary
I am attempting to setup my app to utilize EXPO_PUBLIC environment variables with EAS Update. https://docs.expo.dev/eas-update/environment-variables/
My eas.json:
I have 3 environment files:
Each of these env files contains 1 environment variable EXPO_PUBLIC_API_URL which is the url of my api.
The Problem
When i run the app locally using
yarn expo start
My console outputswhich is correct.
HOWEVER, when I run
eas update --channel staging
My console outputsI have tried messing around with the config files. I've scoured the docs multiple times with no results. I am expecting eas to use the .env.staging config when i run
eas update --channel staging
Environment
Please specify your device/emulator/simulator platform, model and version
iPhone 13 Pro Max
Error output
No response
Reproducible demo or steps to reproduce from a blank project
Starting a project with the above-mentioned .env setup and eas.json setup should reproduce the issue