expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
34.15k stars 5.46k forks source link

[expo-updates] TypeError: commands[command] is not a function #27292

Closed JeroenSchrader closed 8 months ago

JeroenSchrader commented 8 months ago

Summary

I don't know why this error occurs and what caused it. I have successfully submitted an update (the initial update) using this command before. Even going back to the branch that I've successfully submitted an update on, it still gives me that error.

Anyone knows what causes this issue? I haven't seen it documented anywhere and I don't know what to do.

I use "expo-updates": "~0.24.11"

I use the fingerprintExperimental runtimeVersion policy in my app.config.ts

runtimeVersion: {
    /** @see https://docs.expo.dev/eas-update/runtime-versions/#fingerprintexperimental-runtime-version-policy-experimental */
    policy: 'fingerprintExperimental',
  },

The command I run: ENVIRONMENT=PRODUCTION eas update -p all --branch production

Output:

✔ Provide an update message: … Release 1.1.7
[expo-cli] Starting Metro Bundler
[expo-cli] iOS Bundled 24211ms (index.js)
[expo-cli] Android Bundled 28906ms (index.js)
[expo-cli] 
[expo-cli] Creating asset map
[expo-cli] Preparing additional debugging files
[expo-cli] 
[expo-cli] Exporting 63 assets:
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/AntDesign.ttf (70.3 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Entypo.ttf (66.2 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/EvilIcons.ttf (13.5 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Feather.ttf (56.2 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome.ttf (166 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf (134 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf (33.7 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf (203 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome6_Brands.ttf (190 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome6_Regular.ttf (63.3 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome6_Solid.ttf (395 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Fontisto.ttf (314 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Foundation.ttf (57 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Ionicons.ttf (443 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf (1.15 MB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/MaterialIcons.ttf (357 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Octicons.ttf (49.4 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/SimpleLineIcons.ttf (54.1 kB)
[expo-cli] node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Zocial.ttf (25.8 kB)
[expo-cli] node_modules/@react-navigation/drawer/src/views/assets/toggle-drawer-icon.png (10 variations | 139 B)
[expo-cli] node_modules/@react-navigation/elements/src/assets/back-icon-mask.png (913 B)
[expo-cli] node_modules/@react-navigation/elements/src/assets/back-icon.png (10 variations | 338 B)
[expo-cli] src/assets/images/asset-no-image-found.png (16 kB)
[expo-cli] src/assets/images/loading-indicator.webp (1.18 kB)
[expo-cli] src/assets/images/logo-white.png (6.38 kB)
[expo-cli] src/assets/images/logo.png (23 kB)
[expo-cli] src/assets/images/qrcode_scanner_overlay.png (9.17 kB)
[expo-cli] 
[expo-cli] Exporting 2 bundles for ios:
[expo-cli] _expo/static/js/ios/index-048f78daf600f6c29de80213ed1a8ed5.hbc (4.07 MB)
[expo-cli] _expo/static/js/ios/index-048f78daf600f6c29de80213ed1a8ed5.hbc.map (12.5 MB)
[expo-cli] 
[expo-cli] Exporting 2 bundles for android:
[expo-cli] _expo/static/js/android/index-88689964d106f7504cddc5a00cc9761e.hbc (4.07 MB)
[expo-cli] _expo/static/js/android/index-88689964d106f7504cddc5a00cc9761e.hbc.map (12.5 MB)
[expo-cli] Exporting 3 files:
[expo-cli] assetmap.json (31.1 kB)
[expo-cli] debug.html (390 B)
[expo-cli] metadata.json (6.95 kB)
[expo-cli] 
[expo-cli] App exported to: dist
✔ Exported bundle(s)
✔ Uploaded 2 app bundles
✔ Uploading assets skipped - no new assets found
ℹ 54 iOS assets, 54 Android assets (maximum: 2000 total per update). Learn more about asset limits.
Calculating native fingerprint for platform ios using current state of the "ios" directory. If the fingerprint differs from the build's fingerint, ensure the state of your project is consistent (repository is clean, ios and android native directories are in the same state as the build if applicable).
Calculating native fingerprint for platform android using current state of the "android" directory. If the fingerprint differs from the build's fingerint, ensure the state of your project is consistent (repository is clean, ios and android native directories are in the same state as the build if applicable).
[expo-cli] /path/to/my/app/node_modules/expo-updates/build-cli/cli.js:56
[expo-cli] commands[command]().then((exec) => exec(commandArgs));
[expo-cli]                  ^
[expo-cli] 
[expo-cli] TypeError: commands[command] is not a function
[expo-cli]     at Object.<anonymous> (/path/to/my/app/node_modules/expo-updates/build-cli/cli.js:56:18)
[expo-cli]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[expo-cli]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[expo-cli]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[expo-cli]     at Module._load (node:internal/modules/cjs/loader:1023:12)
[expo-cli]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[expo-cli]     at require (node:internal/modules/helpers:176:18)
[expo-cli]     at Object.<anonymous> (/path/to/my/app/node_modules/expo-updates/bin/cli.js:3:1)
[expo-cli]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[expo-cli]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[expo-cli] 
[expo-cli] Node.js v20.10.0
[expo-cli] /path/to/my/app/node_modules/expo-updates/build-cli/cli.js:56
[expo-cli] commands[command]().then((exec) => exec(commandArgs));
[expo-cli]                  ^
[expo-cli] 
[expo-cli] TypeError: commands[command] is not a function
[expo-cli]     at Object.<anonymous> (/path/to/my/app/node_modules/expo-updates/build-cli/cli.js:56:18)
[expo-cli]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[expo-cli]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[expo-cli]     at Module.load (node:internal/modules/cjs/loader:1207:32)
[expo-cli]     at Module._load (node:internal/modules/cjs/loader:1023:12)
[expo-cli]     at Module.require (node:internal/modules/cjs/loader:1235:19)
[expo-cli]     at require (node:internal/modules/helpers:176:18)
[expo-cli]     at Object.<anonymous> (/path/to/my/app/node_modules/expo-updates/bin/cli.js:3:1)
[expo-cli]     at Module._compile (node:internal/modules/cjs/loader:1376:14)
[expo-cli]     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
[expo-cli] 
[expo-cli] Node.js v20.10.0
/path/to/my/app/node_modules/expo-updates/bin/cli.js exited with non-zero code: 1
    Error: update command failed.

What platform(s) does this occur on?

Android, iOS

SDK Version

50

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
      npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    IDEs:
      Android Studio: 2021.2 AI-212.5712.43.2112.8609683
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      expo: ^50.0.6 => 50.0.6 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.73.4 => 0.73.4 
    npmGlobalPackages:
      eas-cli: 7.3.0
    Expo Workflow: managed

Minimal reproducible example

-

wschurman commented 8 months ago

Yep, this was me that caused this. See https://github.com/expo/expo/pull/26839 and https://github.com/expo/expo/pull/26901 for full context, but the gist is that the existing implementation of "fingerprintExperimental" was buggy (produced incorrect and inconsistent hashes) so we're fixing it. Rather than introduce another new "experimental" policy and then remove this one, we decided that since it was experimental to just fix it in place for the next SDK. https://github.com/expo/expo/pull/26901#pullrequestreview-1878628463

The main issue is that it is used in eas-cli (which isn't specific to any particular SDK version) so the changes to support the updated policy needed to be made there.

If you need to keep using the old implementation of the policy, I think the best solution is to stay on version 7.2.0 of eas-cli for now until SDK 51 comes out with the fixed policy (and hopefully renamed to just "fingerprint"). Sorry for the thrash. If absolutely needed we may be able to add the previous version back under a different name, but due to its experimental nature we can't make any guarantees about using it in a project.

JeroenSchrader commented 8 months ago

Reverting to eas-cli@7.2.0 works indeed, thanks! Will upgrade once SDK 51 comes out