Hi all, just looking for some held debugging why my app seems to be receiving the wrong parameters…
I have an extra
section in my app.json
with these sections for api
and auth
:
{
"expo": {
...
"extra": {
"api": {
"host": ""
},
"auth": {
"useEmulator": false,
"emulatorHost": ""
}
}
}
}
Then I update these extra parameters via the app.config.js
file:
My eas.json
doesn’t seem too complicated, and follows this guide for choosing the correct environment in the app.config.js
at build/runtime:
{
"cli": {
"version": ">= 0.46.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"env": {
"APP_ENV": "dev"
}
},
"preview": {
"developmentClient": true,
"distribution": "internal",
"env": {
"APP_ENV": "preview"
}
},
"production": {}
},
"submit": {
"production": {}
}
}
Finally, in my app I consume these parameters via this getConfig()
method (the x
parameter and the console.log
are just there for my debugging):
import Constants from 'expo-constants';
export function getConfig() {
const x = {
apiHost: Constants.expoConfig.extra.api.host,
useEmulator: Constants.expoConfig.extra.auth.useEmulator,
authEmulatorUrl: Constants.expoConfig.extra.auth.emulatorHost,
};
console.log(x);
return x;
}
However of course here’s the interesting part… I
- Run a build for the preview envionment using
eas build --profile preview --platform ios
- Download the built app onto my iPhone
- Do an
expo start --dev-client
on my local machine - Open the app on my iPhone and connect to the dev client just over my home network.
- Once the app has built, it obviously loads up but the confusing bit as that the
console.log
statement above shows all the parameters from the dev section ofapp.config.js
instead of the preview section.
Does anyone have any suggestions as to what I may be doing wrong, or how to debug this further?
Thanks in advance!