eas-cli icon indicating copy to clipboard operation
eas-cli copied to clipboard

EAS doesn’t detect the environment variables.

Open AndreiChe opened this issue 1 year ago • 7 comments

Summary

eas-cli/14.2.0 expo: ~52.0.18

I’ve successfully uploaded variables to the EAS server using this:

eas env:create --scope project --name GOOGLE_SERVICES_JSON --type file --value ./google-services.json

eas env:create --scope project --name GOOGLE_SERVICES_INFO_PLIST --type file --value ./GoogleService-Info.plist

I see them on the website and can pull them via the CLI Screenshot 2024-12-15 at 15 00 11

However, when I build the project, I see a warning.

eas build --platform ios --profile production
No environment variables with visibility "Plain text" and "Sensitive" found for the "production" environment on EAS servers.

Why am I receiving this warning?

What platform(s) does this occur on?

iOS

SDK Version

52.0.18

Environment

expo-env-info 1.2.1 environment info:
    System:
      OS: macOS 15.1.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
      Yarn: 1.22.21 - /opt/homebrew/bin/yarn
      npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
      Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    IDEs:
      Android Studio: 2024.1 AI-241.15989.150.2411.11948838
      Xcode: /undefined - /usr/bin/xcodebuild
    npmPackages:
      expo: ~52.0.18 => 52.0.18 
      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.5 => 0.76.5 
      react-native-web: ~0.19.13 => 0.19.13 
    npmGlobalPackages:
      eas-cli: 14.2.0
    Expo Workflow: bare

Minimal reproducible example

Not applicable

AndreiChe avatar Dec 15 '24 14:12 AndreiChe

hey did you ever find a solution?

I am having same issue with my google service files where the env isn't being registered with production build.

lorddegenx avatar Dec 29 '24 23:12 lorddegenx

No. I had to commit env files to make it work.

AndreiChe avatar Dec 30 '24 13:12 AndreiChe

Hey, Same issue here. This worked before... not sure yet what happened recently. Couldn't trace it down and understand if the issue is on the EAS cloud or the eas-cli package. The Plain Text ENV VARS are not pulled from EAS by the build command.

I can confirm it also occurs for eas-cli v14.1.0 as well as the latest (v14.5.0).

In regards to variables required during compilation (e.g. Firebase config): But it seems the issue only occurs when the environment variable is a file in "plain text" or "sensitive". When I switched to "secret" - it worked for me - and the data was pulled into the build job.

In regards to variables required during runtime and updates (JS): Until recently, only files defined as "plain text" in the environment variables in Expo worked for me ("secret" and "sensitive" didn't work). And now, the "plain text" stopped working. So I switched to individual env vars (instead of using a file that includes those vars in a single JSON object). And it seems to work now. When I execute eas build - I see the "plain text" and "sensitive" vars are fetched properly:

Environment variables with visibility "Plain text" and "Sensitive" loaded from the "development" environment on EAS: VAR_1, VAR_2, etc...

Hope this helps...

orenagiv avatar Jan 28 '25 10:01 orenagiv

eas-cli: 16.15.0 expo: 52.0.47

This is still a bug. Seems like eas-cli or the cloud not able to load env variables for uploaded files.

I have uploaded two files respecitvely to expo env-variables on dashboard: (tried with both PLAIN_TEXT and SECRET)

Image

app.config.ts:

 ios: {
    ...config.ios,
    googleServicesFile: process.env.GOOGLE_SERVICES_FILE_IOS,
  },
  android: {
    ...config.android,
    googleServicesFile: process.env.GOOGLE_SERVICES_FILE_ANDROID,
  }

While building, i don't see the new variables that i have added:

Environment variables with visibility "Plain text" and "Sensitive" loaded from the "preview" environment on EAS: APP_VARIANT, POSTHOG_ENABLED, POSTHOG_HOST, POSTHOG_KEY, SENTRY_AUTH_TOKEN.

  • ANDROID builds fine. (during building from the dashboard, i can see paths to the files fine)
  • IOS build gives the following error:
Failed to read the app config from the project using "npx expo config" command: npx expo config --json --type introspect exited with non-zero code: 1.
Falling back to the version of "@expo/config" shipped with the EAS CLI.
[ios.infoPlist]: withIosInfoPlistBaseMod: [@react-native-firebase/auth] Your app.json file is missing ios.googleServicesFile. Please add this field.
    Error: build command failed.

The error clearly indicates that while building IOS build, eas didn't included that variable in the app.config.ts (because i have seen it before if the variable value is empty it excludes it from the app.config). Somehow its not able to add the path of that .plist file to that variable googleServicesFile.

MR-AMDEV avatar Jul 12 '25 23:07 MR-AMDEV

i’m also experiencing the same issue with environment variables not being detected during iOS builds. When environment variables are set as files, they don’t work on local builds for either Android or iOS. On EAS builds, they only work on Android, but not on iOS.

dogukany avatar Aug 01 '25 19:08 dogukany

i’m also experiencing the same issue with environment variables not being detected during iOS builds. When environment variables are set as files, they don’t work on local builds for either Android or iOS. On EAS builds, they only work on Android, but not on iOS.

BUMP ditto the same problem since September. I am suprised this is still a problem on coming back

HAizelf avatar Nov 24 '25 04:11 HAizelf

seems we need to define schema name for some of plugins in app.json file. For me it was react-native-auth0 plugin which is requires config variables. Seems you have the same story for one/few of your packages.

  1. For the investigation try to remove one by one plugins from your app.json
  2. Once you detected what is problematic package, try to redefine it with params (for my case it was: "plugins": [ "react-native-auth0", //<---- this is problem package "expo-web-browser" ]

but it should be replaced with:

"plugins": [ "react-native-auth0", { "scheme": "myapp", <--- copy this from your app scheme name in the same file "domain": "xxxx", "clientId":"xxxxxxx" } ], "expo-web-browser" 3. Restart your build

eddundead avatar Dec 15 '25 20:12 eddundead