eas-cli
eas-cli copied to clipboard
EAS build in CI fails with Husky and git v2.45.1
Summary
Since May 16th, our builds were failing during the creation of the tarball to upload to EAS with a mysterious error:
Failed to upload the project tarball to EAS Build
Reason: git exited with non-zero code: 128
We investigated and the only difference we could see between the last working build and the first failing one is a change in the Ubuntu version the runner is using.
4 days ago, GitHub updated the image for the Ubuntu 22.04 runner. In the release, they updated the Git version from v2.43.2 to v2.45.1. As we didn't have any error messages, we tried to reproduce the error locally. When installing the latest Git version and running the command EAS CLI is running to clone the repo, we finally saw the error:
Cloning into '/tmp/test-clone'...
remote: fatal: active `core.hooksPath` found in the local repository config:
remote: .husky/_
remote: For security reasons, this is disallowed by default.
remote: If this is intentional and the hook should actually be run, please
remote: run the command again with `GIT_CLONE_PROTECTION_ACTIVE=false`
error: git upload-pack: git-pack-objects died with error.
remote: aborting due to possible repository corruption on the remote side.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
The error was due to core.hooksPath set by husky. We got our builds fixed by adding the environment variable indicated in the error message but I wanted to raise the issue here to avoid other people losing their time as we did. We can also try to find a better solution for this as it is a very common setup to have husky in a project.
Also, one thing that could have improved the debugging right away is to clearly surface the error message in the CLI instead of a git exited with non-zero code: 128 mystic error. Even with DEBUG=* enabled we couldn't see the error. We had to locally install the git version and run the command to see it.
Managed or bare?
Managed
Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/Library/Caches/fnm_multishells/3902_1715758662642/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.2.5 - ~/Library/Caches/fnm_multishells/3902_1715758662642/bin/npm
Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11709847
Xcode: 15.4/15F31d - /usr/bin/xcodebuild
npmPackages:
expo: ^50.0.17 => 50.0.17
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.73.6 => 0.73.6
Expo Workflow: managed
✔ 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 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:
The following scripts in package.json conflict with the contents of node_modules/.bin: prettier.
The following packages should be updated for best compatibility with the installed expo version:
[email protected] - expected version: ~3.29.0
Your project may not work correctly until you install the correct 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
No response
Reproducible demo or steps to reproduce from a blank project
- Init an Expo app
- Add Husky (https://github.com/typicode/husky)
- Try to run
eas buildin a CI (GitHub Action for example)
I am having the exact same issue after debugging with instructions given on the discord channel. It always fails on the cloning stage of the build command.
Managed to fix the issue just like you did but it was a pain to find it out.
FYI, here's the tail end of the Discord discussion: https://discord.com/channels/695411232856997968/1243499689819635772/1243571086583660615
Here's the command that fails:
git clone --no-hardlinks --depth 1 file:///path/to/repository /tmp/dest/dir
and I believe you also need { "cli": { "requireCommit": true } } in eas.json to reproduce the problem.
GIT_CLONE_PROTECTION_ACTIVE=false eas build --platform android
the command saved my life