[Managed Workflow] [Expo SDK 48] using eas-cli@3.13.2
I’ll try to be as accurate as possible.
I’m using both app.json
and app.config.ts
. app.json
mainly has production level configurations, of which are overriden in app.config.ts
if the environment is not production. (Please check code snippets below)
When I build an APK for internal testing via the preview
track (BUILD_ENV
is expected to be set to staging) the APK works as expected.
However. when I build an .aab and submit the app for Close testing via the production
track where BUILD_ENV
is expected to be production, the App (downloaded from the app store) starts off correctly in production, but after restarting the app is relegated to it’s staging configuration!
After some testing, it seems the process.env.BUILD_ENV
is lost and become undentified
after the restart!
I’ve checked the Spin up build environment
stage build logs and everything looks ok…
...
Project environment variables:
BUILD_ENV=production
...
Any help on this? I’ve ran out of ideas .
Example code:
app.config.ts
if (process.env.BUILD_ENV === 'production') {
// PROD config - most fields in app.json should be configured PROD ready
return {
...config,
slug: "app",
name: "App",
extra: <AppVars> {
...config.extra,
ENV_TAG: "production",
...
}
};
} else {
// Staging/Remote DEV config (i.e. TestFlight)
// change bundle/package name to allow us to install different variants of the app on the same device
// https://docs.expo.dev/build-reference/variants/
return <ExpoConfig> {
...config,
name: "App (Staging)",
ios: {
...config.ios,
bundleIdentifier: "com.app.dev",
},
android: {
...config.android,
googleServicesFile: "./google-services.dev.json",
package: "com.app.dev",
},
extra: <AppVars> {
...config.extra,
ENV_TAG: "staging",
...
}
}
}
eas.json
"build": {
"development": {
"distribution": "internal",
"channel": "development",
"android": {
"gradleCommand": ":app:assembleDebug"
},
"ios": {
"buildConfiguration": "Debug"
},
"env": {
"BUILD_ENV": "dev"
}
},
"preview": {
"channel": "staging",
"distribution": "internal",
"env": {
"BUILD_ENV": "staging"
}
},
"production": {
"channel": "production",
"autoIncrement": true,
"env": {
"BUILD_ENV": "production"
}
}
},
P.S. changing the order of the If-statement just inverses the problem where the staging
apk get’s production configurations.