Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAS Build Is Not Parsing SECRETS File Correctly To Prebuild #2070

Closed
leons1767 opened this issue Sep 28, 2023 · 10 comments
Closed

EAS Build Is Not Parsing SECRETS File Correctly To Prebuild #2070

leons1767 opened this issue Sep 28, 2023 · 10 comments
Assignees

Comments

@leons1767
Copy link

leons1767 commented Sep 28, 2023

Summary

I'm using EAS SECRETS environment variable in my app.config.js for iOS googleServicesFile. The build fail because it couldn't find the file.

I can see in the 'Spin up build environment' log that all environment variables are loaded correctly and fed into the app config.

"ios": {
    "supportsTablet": true,
    "bundleIdentifier": "***.************.**********",
    "buildNumber": "**",
    "googleServicesFile": "/Users/expo/workingdir/environment-secrets/********-****-****-****-************"
  },

However, the 'Prebuild' log shows that it did not look in the right directory.

[stderr] Error: [ios.xcodeproj]: withIosXcodeprojBaseMod: ENOENT: no such file or directory, copyfile '/Users/expo/workingdir/build/GoogleService-Info-prod.plist' -> '/Users/expo/workingdir/build/ios/**********/GoogleService-Info.plist'

Managed or bare?

Managed

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: Windows 10 10.0.22621
    Binaries:
      Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 8.19.2 - ~\AppData\Roaming\npm\npm.CMD
      Watchman: 20230416.213759.0 - D:\ReactNative\watchman-v2023.04.17.00-windows\bin\watchman.EXE
    npmPackages:
      @expo/webpack-config: ^19.0.0 => 19.0.0
      expo: ^49.0.13 => 49.0.13
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.5 => 0.72.5
      react-native-web: ~0.19.6 => 0.19.8
    Expo Workflow: bare
WARNING: We recommend using PowerShell or Bash via WSL 2 for development with Expo CLI on Windows. You may encounter issues using cmd.exe.

√ Validating global prerequisites versions passed
√ Checking for incompatible packages passed
√ Checking for conflicting global packages in project passed
× Verifying prebuild support package versions are compatible failed
Issues:
  Expected package @expo/config-plugins@~7.2.2
  Found invalid:
    @expo/[email protected]
    (for more info, run: npm why @expo/config-plugins)
Advice:
  • Upgrade dependencies that are using the invalid package versions.
× Checking dependency versions for compatibility with the installed Expo SDK failed
Issues:
  'sh' is not recognized as an internal or external command,
  operable program or batch file.
Advice:
  • Use npx expo install --check to review and upgrade your dependencies.
√ Validating Expo Config passed
√ Checking package.json for common issues passed

✖ Found one or more possible issues with the project. See above logs for issues and advice to resolve.

Error output

Build failed: "GoogleService-Info.plist" is missing, make sure that the file exists. Remember that EAS Build only uploads the files tracked by git. Use EAS secrets to provide EAS Build with the file.

Reproducible demo or steps to reproduce from a blank project

  1. Upload the GoogleService-Info.plist into EAS SECRETS with GOOGLE_SERIVCES_PLIST as the variable name (or pick any name)
  2. Use the variable name in app.config.js
"ios": {
      ...
      "googleServicesFile": process.env.GOOGLE_SERVICES_PLIST,
      ...
    },
  1. Run eas build --profile development --platform ios
@leons1767 leons1767 added the needs review Issue is ready to be reviewed by a maintainer label Sep 28, 2023
@leons1767
Copy link
Author

I've found the root cause. I didn't add .env to .easignore, and EAS was taking the environment variables from the .env file, instead of SECRETS. Having SECRETS loaded in the 'Spin up build environment' log doesn't mean the build is using them.

There appears to be a bug in the 'Read app config' log. The SECRETS env variables are plugged in the app config, but the build process is actually taking the env variables from .env file. The value in the app config log is not the value the build process is using.

@szdziedzic
Copy link
Member

It seems like a bug on our end. I will try to fix it, thanks!

@szdziedzic szdziedzic self-assigned this Nov 14, 2023
@szdziedzic szdziedzic added issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels Nov 14, 2023
@expo-bot
Copy link
Contributor

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.

@quyentho
Copy link

I also have this problem; I'm glad you guys already noticed it. I leave a comment here to get an update on it.

@ilyagru
Copy link

ilyagru commented Dec 4, 2023

Hey, I guess I have kind of a very similar issue. Please take a look #2141. Any workaround for now?

@quyentho
Copy link

quyentho commented Dec 4, 2023

I have to remove the file from .gitignore, my repo is private so it's fine for me.

Hey, I guess I have kind of a very similar issue. Please take a look #2141. Any workaround for now?

@szdziedzic
Copy link
Member

Hi, I believe that the issue should be fixed, and the Read app config output should be aligned with the npx expo config --type public output

@lsps9150414
Copy link

lsps9150414 commented Jan 21, 2024

hey @szdziedzic When using secret file as env I am still getting this error when run eas build --profile development-simulator --platform ios on my local:

[ios.infoPlist]: withIosInfoPlistBaseMod: [@react-native-firebase/auth] Your app.json file is missing ios.googleServicesFile. Please add this field.

It seems like a local check is done before the remote build job since in Expo dashboard there's no new build created.

I bypassed it by doing this in app.config.ts:

    ios: {
      bundleIdentifier: appIdMap[Channel.DEVELOPMENT],
      googleServicesFile:
        process.env.GOOGLE_SERVICE_INFO_PLIST_DEV ??
        "./firebaseConfigs/GoogleService-Info.dev.plist",
    },

The config files are added to both .gitignore and .easignore.

Is that local check a bug from EAS or am I missing any thing here?

@lifehackett
Copy link

I have the same issue

It seems like a local check is done before the remote build job since in Expo dashboard there's no new build created.

Yeah, this is my thought as well

@Ortbri
Copy link

Ortbri commented May 7, 2024

I have the same issue as well.

I have to remove the file from .gitignore, my repo is private so it's fine for me.

Hey, I guess I have kind of a very similar issue. Please take a look #2141. Any workaround for now?

im going to this until this gets fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants