expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
844 stars 85 forks source link

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

Open jgarplind opened 1 month ago

jgarplind commented 1 month ago

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/metro-config@0.18.5 (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/react-native@5.22.3 - expected version: ~5.24.3 expo@51.0.12 - expected version: ~51.0.38 expo-dev-client@4.0.16 - expected version: ~4.0.28 expo-notifications@0.28.8 - expected version: ~0.28.19 expo-splash-screen@0.27.5 - expected version: ~0.27.6 expo-updates@0.25.16 - expected version: ~0.25.27 react-native@0.74.2 - expected version: 0.74.5 expo-build-properties@0.12.3 - expected version: ~0.12.5 expo-asset@10.0.8 - 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:

jgarplind commented 1 month ago

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 commented 1 month ago

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.

ahmadtech199 commented 1 month ago

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

MPJHorner commented 5 days ago

@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