Hey
I just switched from classic updates to EAS updates this afternoon. Everything worked well so far but when I created my internal distribution build (on iOS and Android), we realized that we don’t get the values from the manifest.
Here’s the snippet of my app.config.ts :
BUILD_NUMBER="1"
BUILD_VERSION="1.0"
...config,
extra: {
eas: {
build: BUILD_NUMBER,
version: BUILD_VERSION,
BASE_URL: process.env.BASE_URL || null,
},
},
Here’s a snippet of my eas.json file preview profile :
"preview": {
"distribution": "internal",
"channel": "preview",
"env": {
"BASE_URL": "https://example.fr"
}
},
Here’s my Env.ts file :
import Constants from "expo-constants";
const getBaseUrl = (): string => {
const BASE_URL =
Constants.manifest2?.extra?.expoClient?.extra?.eas?.BASE_URL ?? Constants.manifest?.extra?.eas?.BASE_URL;
if (!BASE_URL) {
throw new Error("BASE_URL is missing.");
}
return BASE_URL;
};
export const Env = {
BASE_URL: getBaseUrl(),
};
I correctly get my BASE_URL variable but I get undefined when I use Constants.manifest2?.extra?.expoClient?.extra?.eas?.version
or Constants.manifest2?.extra?.expoClient?.extra?.eas?.build
Do you have any idea what I’m doing wrong ? I don’t understand how to correctly get the variables defined in the extra
object.
Thanks a lot !
Config:
- Managed workflow
- SDK 44
- eas-cli : 0.47.0