expo / expo/eas-cli

EAS build in CI fails with Husky and git v2.45.1

Open
#2,388 5 comments 12 reactions 0 assignees View on GitHub
eas build needs review
Dominant language
TypeScript
Stars
1.4k
Forks
236
Avg merge
3d 1h
Merged PRs (30d)
91

Description

### 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](https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20240516.1) 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](https://github.com/expo/eas-cli/blob/61109ea2c180d1e384cb24b3e92dcd247c2bfecb/packages/eas-cli/src/vcs/clients/git.ts#L181-L186) 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](https://github.com/typicode/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:
react-native-screens@3.30.1 - 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 build` in a CI (GitHub Action for example)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.