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

Local credentials cannot be used on only one of the platforms #2723

Open
tamasoszko opened this issue Nov 23, 2024 · 2 comments
Open

Local credentials cannot be used on only one of the platforms #2723

tamasoszko opened this issue Nov 23, 2024 · 2 comments

Comments

@tamasoszko
Copy link

Build/Submit details page URL

No response

Summary

I need to use local credential only on iOS (due to multi target app) and still want to use remote credentials for Android build.
iOS builds just fine with local credentials, however, Android fails.
In the Android build it seems to use the credentials properly:

✔ Using remote Android credentials (Expo server)
✔ Using Keystore from configuration: Default (default)

Yet it still seems to try to read android properties of the credentials.json even though it should use remote. In credentials.json I only define ios since Android should be remote.
Then in the build I got the error : Cannot read properties of undefined (reading 'keystore')
If I specify and empty Android props in the credentials.json like "android": {}, then it fails on the next embedded prop of it:
Cannot read properties of undefined (reading 'keystorePath').
It only builds if I delete the credentials.json file, but then iOS will fail.

Managed or bare?

bare

Environment

expo-env-info 1.2.1 environment info:
    System:
      OS: Linux 6.5 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
      Shell: 5.1.16 - /bin/bash
    Binaries:
      Node: 18.20.5 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.8.2 - /usr/local/bin/npm
    SDKs:
      Android SDK:
        API Levels: 31, 32, 33, 33, 33, 34, 34, 34, 34, 34, 35
        Build Tools: 31.0.0, 32.0.0, 33.0.0, 33.0.1, 33.0.2, 33.0.3, 34.0.0, 35.0.0
        Android NDK: 27.2.12479018
    npmPackages:
      expo: ^52.0.0 => 52.0.7 
      expo-router: ~4.0.7 => 4.0.7 
      react: 18.3.1 => 18.3.1 
      react-dom: 18.3.1 => 18.3.1 
      react-native: 0.76.2 => 0.76.2 
    Expo Workflow: bare

Error output

Cannot read properties of undefined (reading 'keystore')

Reproducible demo or steps to reproduce from a blank project

build command that fails:

eas build --local --non-interactive --platform=android --profile=stage --output=build/app-stage.apk

eas.json:

{
    "build":
    {
        "stage":
        {
            "android":
            {
                "credentialsSource": "remote"
            },
            "env":
            {
               ...
            },
            "ios":
            {
                "credentialsSource": "local"
            }
        },
        ...
    }
}

credentials.json:

{
  "ios": {
    "target-1": {
      "provisioningProfilePath": "...",
      "distributionCertificate": {
        "path": "...",
        "password": "..."
      }
    },
	"target-2": {
      "provisioningProfilePath": "...",
      "distributionCertificate": {
        "path": "...",
        "password": "..."
      }
    },
    "target-3": {
      "provisioningProfilePath": "...",
      "distributionCertificate": {
        "path": "...",
        "password": ".."
      }
    },
  }
}
@tamasoszko tamasoszko added the needs review Issue is ready to be reviewed by a maintainer label Nov 23, 2024
@szdziedzic
Copy link
Member

I can't really replicate it when I have an app with credentials.json set up for iOS only and your stage build profile 🤔

➜  managed git:(master) ✗ eas build -p all -e stage
We detected that you are building for the "store" distribution. Resolving the environment for environment variables used during the build to "production". Set the "environment" field in the build profile if you want to specify the environment manually.
No environment variables with visibility "Plain text" and "Sensitive" found for the "production" environment on EAS servers.


🤖 Android build
✔ Using remote Android credentials (Expo server)
✔ Using Keystore from configuration: test2 (default)

Compressing project files and uploading to EAS Build. Learn more
✔ Uploaded to EAS 1s
✔ Computed project fingerprint
We detected that you are building for the "store" distribution. Resolving the environment for environment variables used during the build to "production". Set the "environment" field in the build profile if you want to specify the environment manually.
No environment variables with visibility "Plain text" and "Sensitive" found for the "production" environment on EAS servers.


🍏 iOS build
✔ Using local iOS credentials (credentials.json)

Compressing project files and uploading to EAS Build. Learn more
✔ Uploaded to EAS 1s
✔ Computed project fingerprint

I only have ios credentials in credentials.json.

It seems to correctly use local credentials for iOS and remote credentials for Android.

@szdziedzic
Copy link
Member

What CLI version do you use? Can you create a repo with such a setup for which it fails for you (with mock credentials)? Maybe I configured something wrong 🤔

@szdziedzic szdziedzic added eas build and removed needs review Issue is ready to be reviewed by a maintainer labels Dec 6, 2024
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

2 participants