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

[12.6.0] Authentication with Apple Developer Portal failed - "The first argument must be..."

Open jgarplind opened this issue 1 year ago • 2 comments
trafficstars

Build/Submit details page URL

No response

Summary

Running any eas command requiring Apple login, e.g. eas credentials lets me go as far as entering my password, then it fails.

Managed or bare?

Both

Environment

expo-env-info 1.2.0 environment info: System: OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish) Shell: 5.1.16 - /bin/bash Binaries: Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node Yarn: 1.22.22 - /mnt/c/Program Files/nodejs/yarn npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm npmPackages: expo: ^51.0.0 => 51.0.12 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.74.2 => 0.74.2 react-native-web: ~0.19.10 => 0.19.12 npmGlobalPackages: eas-cli: 12.6.0 Expo Workflow: bare

✔ 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 app config fields that may not be synced in a non-CNG project ✔ Check if the project meets version requirements for submission to app stores ✔ Check for issues with Metro config ✔ Check npm/ yarn versions ✔ Check Expo config (app.json/ app.config.js) schema ✔ Check for legacy global CLI installed locally ✔ Check that native modules do not use incompatible support packages ✖ Check that packages match versions required by installed Expo SDK ✖ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

Expected package @expo/metro-config@~0.18.11 Found invalid: @expo/[email protected] (for more info, run: npm why @expo/metro-config) Advice: Upgrade dependencies that are using the invalid package versions.

This project contains native project folders but also has native configuration properties in app.config.ts, indicating it is configured to use Prebuild. When the android/ios folders are present, EAS Build will not sync the following properties: orientation, icon, userInterfaceStyle, scheme, splash, ios, android, plugins, updates.

Advice: Add '/android' and '/ios' to your .easignore file if you intend to use CNG / Prebuild. Learn more: https://docs.expo.dev/workflow/prebuild/#usage-with-eas-build

The following packages should be updated for best compatibility with the installed expo version: @sentry/[email protected] - expected version: ~5.24.3 [email protected] - expected version: ~51.0.38 [email protected] - expected version: ~4.0.28 [email protected] - expected version: ~0.28.19 [email protected] - expected version: ~0.27.6 [email protected] - expected version: ~0.25.27 [email protected] - expected version: 0.74.5 [email protected] - expected version: ~0.12.5 [email protected] - expected version: ~10.0.10 Your project may not work correctly until you install the expected versions of the packages. Found outdated dependencies Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Error output

✖ Logging in...
Authentication with Apple Developer Portal failed!
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (node:buffer:320:9)
    at u (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/node_modules/@expo/apple-utils/build/index.js:1:739706)
    at async Object.calculateProof (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/node_modules/@expo/apple-utils/build/index.js:1:738871)
    at async /root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/node_modules/@expo/apple-utils/build/index.js:1:729981
    at async k (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/node_modules/@expo/apple-utils/build/index.js:1:728655)
    at async Object.w [as loginWithUserCredentialsAsync] (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/node_modules/@expo/apple-utils/build/index.js:1:728224)
    at async loginWithUserCredentialsAsync (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/build/credentials/ios/appstore/authenticate.js:84:24)
    at async loginAsync (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/build/credentials/ios/appstore/authenticate.js:56:16)
    at async authenticateAsUserAsync (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/build/credentials/ios/appstore/authenticate.js:129:27)
    at async authenticateAsync (/root/.nvm/versions/node/v20.18.0/lib/node_modules/eas-cli/build/credentials/ios/appstore/authenticate.js:101:16) {
  code: 'ERR_INVALID_ARG_TYPE'
}
    Error: credentials command failed.

Reproducible demo or steps to reproduce from a blank project

  1. npx create-expo-app@latest StickerSmash
  2. Set up a baseline eas.json
  3. Follow the CLI instructions

Things of note:

  • OS: Ubuntu (not macOS). Also tried running eas credentials on Windows to no avail.
  • Apple Developer Account: Part of an organization, not an individual. My account logs in using OAuth (SAML), not directly through Apple.
  • Did this work before? ~Probably not, it's the first time I'm trying~ Actually, I recall it worked once before (on Ubuntu) with another account that I was able to use just to verify that the flows worked. This implies to me that the difference between the way our Apple Developer Accounts are configured could be a key factor.
  • I followed the stack trace until authenticate.js turns to @expo/apple-utils which appears to be closed source so I can't follow it and understand further.

jgarplind avatar Oct 24 '24 13:10 jgarplind

Well, I think I found the reason confirmed after delving through the docs for a while:

https://docs.expo.dev/app-signing/apple-developer-program-roles-and-permissions/#eas-build

EAS CLI can only accept an Apple account's email and password to login into your Apple Developer account. You cannot login into Federated Apple Developer account and make updates to the distribution certificate or provisioning profile.

I would close the issue myself, but I'll let you do it since I want to suggest that if it's possible to recognize that federtation is the cause of the login not working, a link to those docs rather than the generic:

"The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined"

would probably save many developers hours of debugging.

jgarplind avatar Oct 24 '24 15:10 jgarplind

Took some time to look into to the supposed solution: https://docs.expo.dev/build/building-on-ci/#optional-provide-an-asc-api-token-for-your-apple-team

As far as I can tell, setting up the requested environment variables (EXPO_ASC_API_KEY_PATH, EXPO_ASC_KEY_ID, EXPO_ASC_ISSUER_ID, EXPO_APPLE_TEAM_ID, EXPO_APPLE_TEAM_TYPE) ~does not impact the flow~. It does if they are prepended to whatever command I'm running, but not if I pre-assign them like so: EXPO_ASC_API_KEY_PATH=/something/else and then run the command in a separate execution.

jgarplind avatar Oct 25 '24 12:10 jgarplind

I saw the same error but I fixed it this time this way npm i eas-cli -D

ahmadtech199 avatar Oct 27 '24 03:10 ahmadtech199

@jgarplind i had the same issue, i used these infront of eas credentials and was able to recreate expired provision profiles etc.

ie

EXPO_ASC_API_KEY_PATH=~/Downloads/AuthKey_ABCD1234.p8 \
EXPO_ASC_KEY_ID=ABCD1234 \
EXPO_ASC_ISSUER_ID=12345678-abcd-efgh-ijkl-123456789012 \
EXPO_APPLE_TEAM_ID=AB12CD34EF \
EXPO_APPLE_TEAM_TYPE=COMPANY_OR_ORGANIZATION \
eas credentials

MPJHorner avatar Nov 20 '24 16:11 MPJHorner