eas update version runtime not changing based on environment
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 236
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 91
Description
### Build/Submit details page URL
_No response_
### Summary
``eas update --environment preview --channel preview --message "test new eas env" --platform ios``
Ive been having this issue pre and post SDK52 where i used my own setup for env vars compared to the new env vars but it works where in my app.config.ts that during the execution of the command above it logs the correct messages for what env its on but it doesnt take the version number that I have causing the update to go to 1.0.0 instead of the version specified in the app.config.ts . Weirdly enough we build so ``eas build --platform ios --profile preview`` it pulls the version number.
### Managed or bare?
Managed
### Environment
``npx expo-env-info``
expo-env-info 1.2.1 environment info:
System:
OS: macOS 15.1.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v20.17.0/bin/yarn
npm: 10.8.3 - ~/.nvm/versions/node/v20.17.0/bin/npm
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.1, iOS 18.1, macOS 15.1, tvOS 18.1, visionOS 2.1, watchOS 11.1
Android SDK:
API Levels: 34
Build Tools: 30.0.3, 33.0.1, 34.0.0, 35.0.0, 35.0.0
System Images: android-28 | Google APIs ARM 64 v8a, android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12483815
Xcode: 16.1/16B40 - /usr/bin/xcodebuild
npmPackages:
expo: ^52.0.17 => 52.0.17
expo-router: ~4.0.11 => 4.0.11
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: 0.76.3 => 0.76.3
react-native-web: ~0.19.13 => 0.19.13
npmGlobalPackages:
eas-cli: 14.1.0
expo-cli: 6.3.12
Expo Workflow: managed
``npx expo-doctor``
Enabled experimental React Native Directory checks. Unset the EXPO_DOCTOR_ENABLE_DIRECTORY_CHECK environment variable to disable this check.
✖ Check package.json for common issues
✔ Check Expo config for common issues
✔ Check native tooling versions
✔ Check if the project meets version requirements for submission to app stores
✔ Check for common project setup issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check for issues with Metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✖ Validate packages against React Native Directory package metadata
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that packages match versions required by installed Expo SDK
Detailed check results:
The following scripts in package.json conflict with the contents of node_modules/.bin: tsc.
The following issues were found when validating your dependencies against React Native Directory:
Untested on New Architecture: react-native-element-dropdown
No metadata available: @dev-plugins/react-query, @expo/config-plugins, @google-cloud/firestore, @passiolife/nutritionai-react-native-sdk-v3, expo-health-connect, firebase, immer, passio-nutrition-advisor-client, promise, prop-types, react-native-firebase, react-native-wheel-scrollview-picker, rimraf
Advice:
- Use libraries that are actively maintained and support the New Architecture. Find alternative libraries with https://reactnative.directory.
- Add packages to expo.doctor.reactNativeDirectoryCheck.exclude in package.json to selectively skip validations, if the warning is not relevant.
- Update React Native Directory to include metadata for unknown packages. Alternatively, set expo.doctor.reactNativeDirectoryCheck.listUnknownPackages in package.json to false to skip warnings about packages with no metadata, if the warning is not relevant.
One or more checks failed, indicating possible issues with the project.
### Error output
_No response_
### Reproducible demo or steps to reproduce from a blank project
//app.config.ts
```
import "ts-node/register";
import { ExpoConfig, ConfigContext } from "expo/config";
import { environmentUtil } from "./utils/enviroment";
const environment: "staging" | "production" | "localhost" = environmentUtil();
console.log("Environment: ", environment);
export default ({ config }: ConfigContext): ExpoConfig => {
const appConfig: ExpoConfig = {
...config,
};
if (environment === "staging") {
console.log("Staging Environment");
return {
...appConfig,
name: "app",
slug: "app",
version: "1.0.1",
runtimeVersion: "1.0.1",
ios: {
googleServicesFile:
process.env.GoogleService_Info_stage ||
"./GoogleService-Info-stage.plist",
bundleIdentifier: "***"
},
extra: {
eas: {
projectId: "*****"
}
},
updates: {
url: "https://u.expo.dev/*******"
}
};
}
if (environment === "production") {
return {
...appConfig,
};
}
return appConfig;
};
```
//app.json
```
{
"expo": {
"name": "",
"slug": "-",
"owner": "...",
"orientation": "portrait",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": false,
"usesAppleSignIn": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"runtimeVersion": {
"policy": "appVersion"
},
}
}
```
//eas.json
```
{
"cli": {
"version": ">= 5.2.0",
"appVersionSource": "remote"
},
"build": {
"preview": {
"autoIncrement": true,
"distribution": "store",
"ios": {
"buildConfiguration": "Release",
"simulator": false
},
"channel": "preview",
"environment": "preview"
},
},
}
```
//environment.ts
```
export const environmentUtil = (): "staging" | "production" | "localhost" => {
const environment: string | boolean = process.env.APP_VARIANT || "localhost";
if (environment === "staging") {
return "staging";
}
if (environment === "production") {
return "production";
}
return "localhost";
};
```
in the terminal
1. eas env:create
2. for variable name ``APP_VARIANT``
3. type: ``String``
4. visibility: ``Plain text``
5. value: ``staging``
6. for environment select ``preview``
7. eas build --platform ios --platform preview
8. eas update --environment preview --channel preview --platform ios
Contributor guide
Assessment
This issue has not been assessed yet.