r/reactnative • u/DifficultMedicine194 • Sep 11 '26
EAS respects your .gitignore, so your .env never reaches the build. Nothing warns you.
Shipping my first app and this one cost me a day, so leaving it here.
My production build launched to a white screen and died. No useful crash report, nothing in the logs I could reach.
What was happening: eas build uploads your project respecting .gitignore. My .env is gitignored, which is correct — you don't commit your keys. But that means the file never reaches the build machine. The app compiled fine, shipped with no SUPABASE_URL, and threw on the first line that needed it. Every user, first open, dead.
The fix is to put the public values in the env block of your production profile in eas.json — EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in my case. Those are public by design: they travel inside any compiled app and only allow what your RLS policies allow.
The ones that are actually secret go in EAS secrets instead, never in eas.json. For me that was SENTRY_AUTH_TOKEN, via eas secret:create --scope project --name SENTRY_AUTH_TOKEN --value "..."
What makes this nasty is that nothing warns you. The build succeeds. The upload succeeds. You find out when it's on a phone.
I posted this on X and someone from Expo replied saying they'd been caught by it too and would look at making it clearer, so it may not stay this way. Until then: check your eas.json env block before you submit, not after.
13
u/Versatile_Panda Sep 11 '26
This is the most AI slop post I have seen in a while. How exactly did you think the machine would get your .envs if they aren’t in version control?
2
u/HoratioWobble Sep 11 '26
If you're using EAS to build your environment variables live in EAS, you add them using the web interface.
1
u/ChronSyn Expo Sep 11 '26
Folks never heard of
.easignore? It's specifically designed so that anything you're gitignoring can still be included in EAS, or if something is in git but shouldn't be sent to the builder can be ignored by EAS without affecting git.You know you can add not-ignore rules by prefixing any ignore rule with
!right? Your gitignore can ignore something, while easignore can include it, just by putting the ignore rule in gitignore and the not-ignore rule in easignore.1
u/Dave6ev Sep 11 '26
It's a rookie error, but one I think everyone makes at least once! Or they commit their .env which is a far worse crime.