expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
795 stars 82 forks source link

EAS overwriting `ENVIRONMENT` env var #2287

Open onlyanegg opened 6 months ago

onlyanegg commented 6 months ago

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
expo-bot commented 6 months ago

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

szdziedzic commented 6 months ago

Hi, thanks for the report. I was able to reproduce it.