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

Can't Upload a .plist to Expo Secrets #2686

Closed
topherjamesknoll opened this issue Nov 12, 2024 · 2 comments
Closed

Can't Upload a .plist to Expo Secrets #2686

topherjamesknoll opened this issue Nov 12, 2024 · 2 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@topherjamesknoll
Copy link

Build/Submit details page URL

No response

Summary

I'm trying to use the files I generated from Firebase for react-native-firebase. I have one .json file and one .plist file. I'm trying to store them in Expo Secrets so I don't have to commit them to my repo. I've successfully uploaded and used my .json file using these steps: https://docs.expo.dev/build-reference/variables/#how-to-upload-a-secret-file-and-use-it-in-my-app-config. I ran eas build --platform android and all was well in the resulting build. But, when I try to do the same thing uploading a .plist file and run eas build --platform ios I get 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: ENOENT: no such file or directory, open '/Users/topher/Projects/bessa/GOOGLE_SERVICES_FILE_IOS'

I have the following under ios in my app.config.js file:

googleServicesFile: process.env.GOOGLE_SERVICES_FILE_IOS

I also have, and I don't know if I need to, but it works, under production.env in my eas.json file:

"GOOGLE_SERVICES_FILE_IOS": "GOOGLE_SERVICES_FILE_IOS",

Managed or bare?

Managed

Environment

expo-env-info 1.2.1 environment info:
System:
OS: macOS 15.0.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.12.2/bin/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.12.2/bin/npm
Watchman: 2024.04.29.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.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
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12550806
Xcode: 16.1/16B40 - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.39 => 51.0.39
expo-router: ~3.5.24 => 3.5.24
react: 18.2.0 => 18.2.0
react-native: 0.74.5 => 0.74.5
npmGlobalPackages:
eas-cli: 13.1.1
Expo Workflow: managed

✔ 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
✔ Check that packages match versions required by installed Expo SDK
✔ 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

Detailed check results:

Expected package @expo/config-plugins@~8.0.0
Found invalid:
@expo/[email protected]
(for more info, run: npm why @expo/config-plugins)
Expected package metro@~0.80.8
Found invalid:
[email protected]
(for more info, run: npm why metro)
Expected package metro-resolver@~0.80.8
Found invalid:
[email protected]
(for more info, run: npm why metro-resolver)
Expected package metro-config@~0.80.8
Found invalid:
[email protected]
(for more info, run: npm why metro-config)

Error output

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: ENOENT: no such file or directory, open '/Users/topher/Projects/bessa/GOOGLE_SERVICES_FILE_IOS'

Reproducible demo or steps to reproduce from a blank project

I uploaded my .plist file to Expo Secrets under the key, GOOGLE_SERVICES_FILE_IOS
I added GOOGLE_SERVICES_FILE_IOS to eas.json
I switched my app config from app.json to app.config.js and exported the JSON
I used process.env.GOOGLE_SERVICES_FILE_IOS to insert my file under ios.googleServicesFile
I ran eas build and selected ios, then I received the error.

@topherjamesknoll topherjamesknoll added the needs review Issue is ready to be reviewed by a maintainer label Nov 12, 2024
@szdziedzic
Copy link
Member

I believe that your issue is that you put GOOGLE_SERVICES_FILE_IOS in the env section of your build profile in eas.json. Using this env var in your current setup lets expo config know where to look for the Google services .plist file, and I believe it's not under /path/to/your/project/directory/GOOGLE_SERVICES_FILE_IOS, right?

What you need to do to make it work is:

  1. remove this env from eas.json
  2. Alter your app config so it's googleServicesFile: process.env.GOOGLE_SERVICES_FILE_IOS ?? '/your/local/path/to/the/file'

This way:

  1. The file secret that EAS puts under the path that is held by process.env.GOOGLE_SERVICES_FILE_IOS will be used on cloud builds
  2. '/your/local/path/to/the/file' will be used for local development and will be available when resolving config when using EAS CLI.

@topherjamesknoll
Copy link
Author

@szdziedzic Ah, thanks for the reply! Yeah, I was going to update this just now. I added the ternaries as you suggested and removed them from eas.json and it actually builds now:

googleServicesFile: process.env.GOOGLE_SERVICES_FILE_IOS ?? "./GoogleService-Info-dev.plist"
I'll open an issue with react-native-firebase just in case but I still think there's something wonky with the iOS file. I can log in with an Android in production to my app just fine but I get "auth/internal-error" when trying to login on an iOS device.

Yes, I have a local copy of the .plist file with dev credentials, and my prod credentials are uploaded to Expo.dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants