expo / expo/eas-cli

EAS overwriting `ENVIRONMENT` env var

Open
#2,287 4 comments 0 reactions 0 assignees View on GitHub
eas build issue accepted needs review
Dominant language
TypeScript
Stars
1.4k
Forks
236
Avg merge
3d 1h
Merged PRs (30d)
91

Description

### Build/Submit details page URL

https://expo.dev/accounts/coutotyler/projects/expo-environment/builds/cfe317ce-5fcb-4f3e-a2aa-81ac4ee701d2

### Summary

Something seems to be overwriting our `ENVIRONMENT` env var defined in `eas.json` and setting it to "production".

### Managed or bare?

managed

### Environment

```
$ npx expo-env-info

expo-env-info 1.2.0 environment info:
System:
OS: macOS 13.6.2
Shell: 5.2.26 - /opt/homebrew/bin/bash
Binaries:
Node: 18.19.1 - ~/.local/bin/node
Yarn: 1.22.19 - ~/.local/bin/yarn
npm: 10.2.4 - ~/.local/bin/npm
Managers:
CocoaPods: 1.12.1 - /Users/tylercouto/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 15.2/15C500b - /usr/bin/xcodebuild
npmPackages:
expo: ~50.0.13 => 50.0.13
react: 18.2.0 => 18.2.0
react-native: 0.73.5 => 0.73.5
npmGlobalPackages:
expo-cli: 5.4.11
Expo Workflow: managed
$
$ npx expo-doctor
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check npm/ yarn versions
✔ 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

Didn't find any issues with the project!
```

### Error output

_No response_

### Reproducible demo or steps to reproduce from a blank project

```
$ npx create-expo-app expo-environment
$ cd expo-environment/
$ vim app.config.js
$ vim eas.json
$ vim app.json
$ vim .envrc
$ cat app.config.js
export default ({ config }) => {
const { ENVIRONMENT } = process.env;

if (ENVIRONMENT !== "myenv") {
console.log(process.env);

throw new Error("ENVIRONMENT was overwritten");
}

return config;
};
$ cat eas.json
{
"build": {
"base": {
"node": "18.18.2",
"yarn": "1.22.18"
},
"local": {
"extends": "base",
"channel": "local",
"distribution": "internal",
"developmentClient": true,
"ios": {
"simulator": true
},
"env": {
"ENVIRONMENT": "myenv"
}
}
}
}
$ cat app.json
{
"expo": {
"name": "expo-environment",
"slug": "expo-environment",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"package": "coutotyler.expoEnvironment",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "324370f5-6759-4123-952d-c23ac1258018"
}
},
"updates": {
"url": "https://u.expo.dev/324370f5-6759-4123-952d-c23ac1258018"
},
"runtimeVersion": {
"policy": "appVersion"
}
}
}
$ cat .envrc
export ENVIRONMENT=myenv
$ direnv allow
$ yarn
$ eas login
$ eas build --platform android --profile local
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.