Production Builds
Configure environment variables for EAS Build production builds.
🚫
Critical: Add all environment variables to eas.json
or your production builds will fail.
Environment Variables Reference
# Required
EXPO_PUBLIC_SUPABASE_URL=""
EXPO_PUBLIC_SUPABASE_ANON_KEY=""
EXPO_PUBLIC_SUPABASE_BUCKET_NAME=""
# Optional - Push Notifications
EXPO_PUBLIC_ONE_SIGNAL_APP_ID=""
# Optional - In-App Purchases
EXPO_PUBLIC_REVENUE_CAT_API_KEY_APPLE=""
# Optional - Error Tracking
EXPO_PUBLIC_SENTRY_DSN=""
EXPO_PUBLIC_SENTRY_URL="https://sentry.io/"
EXPO_PUBLIC_SENTRY_PROJECT=""
EXPO_PUBLIC_SENTRY_ORGANIZATION=""
# Optional - Analytics
EXPO_PUBLIC_POSTHOG_API_KEY=""
EXPO_PUBLIC_POSTHOG_HOST=""
EAS Configuration
Add environment variables to your eas.json
file:
{
"cli": {
"version": ">= 7.5.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"env": {
"EXPO_PUBLIC_SUPABASE_URL": "your-production-supabase-url",
"EXPO_PUBLIC_SUPABASE_ANON_KEY": "your-production-supabase-anon-key",
"EXPO_PUBLIC_SUPABASE_BUCKET_NAME": "your-storage-bucket-name",
"EXPO_PUBLIC_ONE_SIGNAL_APP_ID": "your-onesignal-app-id",
"EXPO_PUBLIC_REVENUE_CAT_API_KEY_APPLE": "your-revenuecat-apple-key"
}
}
},
"submit": {
"production": {}
}
}
Build Commands
# Build for production
eas build --platform all --profile production
# Submit to stores
eas submit --platform ios
eas submit --platform android
Using EAS Secrets
For sensitive values, use EAS Secrets instead of putting them in eas.json
:
# Add secret
eas secret:create --scope project --name REVENUE_CAT_API_KEY_APPLE --value your-secret-value
# Reference in eas.json
{
"build": {
"production": {
"env": {
"EXPO_PUBLIC_REVENUE_CAT_API_KEY_APPLE": "@REVENUE_CAT_API_KEY_APPLE"
}
}
}
}
Common Issues
- Build fails/app crashes after build: Missing environment variables in
eas.json
- Variables undefined: Use
EXPO_PUBLIC_
prefix for client-side variables - Wrong values: Ensure variable names match exactly between code and
eas.json