The app on EAS
The variables each EAS environment needs before a preview or store build, which of them need a new build, and the commands to set them.
The native app is built on EAS, one stage at a time: development, preview and production. Each
stage has the same name three times in apps/native/eas.json: the build profile, the EAS
environment whose variables go into the build, and the update channel its builds listen on. The
commands are on the Native app page.
Where a build's values come from
Only from the stage's EAS environment. apps/native/.env is git-ignored, so EAS doesn't upload
it. A variable the environment doesn't set falls back to its default in apps/native/.env.schema,
and those defaults are the local stack's.
Left to those defaults, a preview or production build would talk to 127.0.0.1. So both stages
check their environment first: EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_POWERSYNC_URL must be
https URLs, and EXPO_PUBLIC_SUPABASE_KEY must be set.
bun run eas:build:preview,eas:build:productionand the two update commands run the check on your machine before they start (eas env:execwith the stage's variables, your local.envignored), and stop with the missing names.- A build started with
eas builddirectly stops on EAS's server, while it readsapps/native/app.config.ts(releaseEnvProblems), before anything is compiled.
An eas update run by hand isn't checked: use bun run eas:update:<stage>.
The variables
| Variable | Value | Read |
|---|---|---|
EXPO_PUBLIC_SUPABASE_URL | https://api.example.com | bundle |
EXPO_PUBLIC_SUPABASE_KEY | the publishable key (SUPABASE_PUBLISHABLE_KEY on the server) | bundle |
EXPO_PUBLIC_POWERSYNC_URL | https://sync.example.com | bundle |
EXPO_PUBLIC_SITE_URL | https://www.example.com; only an https URL turns on Universal and App Links | build |
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID | the web OAuth client id, the one Supabase Auth has; empty = no Google button | bundle |
EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID | the iOS OAuth client id | build |
EXPO_PUBLIC_REVENUECAT_IOS_KEY | RevenueCat's public App Store SDK key; empty = purchases off on iOS | bundle |
EXPO_PUBLIC_REVENUECAT_ANDROID_KEY | RevenueCat's public Play Store SDK key; empty = purchases off on Android | bundle |
EXPO_PUBLIC_SENTRY_DSN | the listoca-native project's DSN; empty = no crash reports | bundle |
EXPO_PUBLIC_ANALYTICS_PROVIDER | umami, custom or empty | bundle |
EXPO_PUBLIC_UMAMI_WEBSITE_ID | with Umami: the site's id | bundle |
EXPO_PUBLIC_UMAMI_SCRIPT_URL | with a self-hosted Umami: the web app's script URL | bundle |
EXPO_PUBLIC_ANALYTICS_CUSTOM_URL | with custom: where the events go | bundle |
SENTRY_AUTH_TOKEN | uploads the build's source maps; see Sentry | build |
Leave these out:
EXPO_PUBLIC_REVENUECAT_TEST_KEY: the Test Store key is for development builds only, and RevenueCat stops a release build that carries it.EXPO_PUBLIC_SENTRY_ENVIRONMENT: without it, Sentry names the environment after the build's update channel.NODE_ENV: Expo sets it.
The comments in apps/native/.env.schema describe each variable in more detail.
Build or bundle
- build:
apps/native/app.config.tsor the Sentry plugin reads the value while EAS builds the native app.EXPO_PUBLIC_SITE_URLdecides the associated domains,EXPO_PUBLIC_GOOGLE_IOS_CLIENT_IDthe URL scheme of Google's sign-in. A change needs a new build through the store, and a raisedversioninapps/native/app.json(see Updates without a store release on the Native app page). - bundle: the value goes into the JavaScript. An update carries a change:
eas:update:previewandeas:update:productionbuild the bundle with the stage's environment.
Per stage
- production: the values of your production server (Coolify or the plain Docker setup), the store keys, Sentry, analytics.
- preview: builds for testers, so the values of a staging server if you run one, else the production ones. Testers then work on real data.
- development: a development build loads its JavaScript from Metro on your machine, and Metro
reads your local
apps/native/.env. The EAS environment only needs the build values:EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID, andEXPO_PUBLIC_SITE_URLif you test links on a phone.
Setting them
On expo.dev (the project → Environment variables), or with the EAS CLI from apps/native. The
EXPO_PUBLIC_ values end up in the app, where anyone can read them, so they are plaintext:
eas env:create --environment production --name EXPO_PUBLIC_SUPABASE_URL --value https://api.example.com --visibility plaintexteas env:create --environment production --name EXPO_PUBLIC_POWERSYNC_URL --value https://sync.example.com --visibility plaintextAdd --force to change a value that exists. To check a stage:
eas env:list --environment productioneas env:pull --environment production writes the stage's values to apps/native/.env.local, which
your local Metro then uses too. Delete the file afterwards, or development builds talk to the
production server.
Sentry
The Sentry plugin in apps/native/app.json (org birkmdev, project listoca-native) uploads
source maps at the end of every release build. Give it a token, as a secret:
eas env:create --environment production --name SENTRY_AUTH_TOKEN --value <token> --visibility secretWithout Sentry, set SENTRY_DISABLE_AUTO_UPLOAD to true instead, or the upload fails the build.
The source maps of an update are uploaded by hand (Monitoring).
Then build
From the repo root:
bun run eas:build:productionEAS counts the build number up (appVersionSource: remote). The store credentials (signing,
the APNs key and FCM for push) live on EAS too: eas credentials, or the prompts of the first
build. LAUNCH.md lists what the stores need before the first submission.
Related
- Native app: the build and update commands, the update rules.
- Monitoring: Sentry for the app and the web.
- Payments: the RevenueCat keys and the paywall.