0

This question is about a network issue when Running Expo builds on your own infrastructure with Expo EAS CLI.


I am trying to run eas build --platform android --non-interactive --local but I am facing a network error:

...
[PREBUILD] [5/5] Building fresh packages...
[PREBUILD] success Saved lockfile.
[PREBUILD] Done in 36.84s.
[PREPARE_CREDENTIALS] Writing secrets to the project's directory
[PREPARE_CREDENTIALS] Injecting signing config into build.gradle
[CONFIGURE_EXPO_UPDATES] Using default release channel for 'expo-updates' (default)
[RUN_GRADLEW] Running 'gradlew :app:assembleRelease' in /tmp/root/eas-build-local-nodejs/f1c1ab1b-fe51-4bc9-a46a-bfab5cc8c2f7/build/01_App/frontend/android
[RUN_GRADLEW] Downloading https://services.gradle.org/distributions/gradle-7.3.3-all.zip
[RUN_GRADLEW] Exception in thread "main"
[RUN_GRADLEW] java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.3.3-all.zip failed: timeout
...

However, calling wget https://services.gradle.org/distributions/gradle-7.3.3-all.zip works! Therefore, this network issue only happens from within the eas build command.

I am running this from a corporate network, and it is not the first time I encounter weird network issues that are hard and tiring to debug. It might be something with DNS resolution, with Docker, with firewall rules, with TLS certificates, I don't know. I've even found another machine from which it works, but I need to run this on this machine.

I'd like to work around this, instead of finding the root cause of the network issue. Since I can download this zip file myself very easily, I was hoping for a way for me to give it to eas build so that it doesn't try to download it.

  • Maybe by putting the zip file in a specific folder?
  • Maybe by doing something with the zip file (unzipping, installing somehow)?
  • Something else?

The goal is to make eas build decide it does not need to do this. How can I achieve this?

Thanks!

Pedro A
  • 3,989
  • 3
  • 32
  • 56

1 Answers1

2

Yes, You can overcome the issue easily I guess.

If you can download using a normal browser, Is there any proxy configuration added to your browser so you can access external network?

If yes, Then it's pretty simple.

There are 3 things you can try according to my understanding of this.

First,

As you have downloaded the zip, It will contain Gradle-7.3.3, If you want, you can add Gradle to the system instant of using the wrapper, Once this is done. You can type Gradle wrapper command which will add gradle/wrapper folder with valid info and this should be enough to solve the issue.

Second,

You can manually configure, by copying the file needed into the path.

This can be found in gradle/wrapper/gradle-wrapper.properties which looks like this

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

So what you have to do is, go to wrapper/dists and copy the zip file, and the build system will check that it is valid and you won't have to download it again.

Third, If there is proxy configuration, Its way easier to set the rules to gradle/gradle-wrapper

You can either set the rules globally, or locally by adding this to gradle.properties or gradle-wrapper.properties

systemProp.https.proxyHost={PROXY IP}
systemProp.https.proxyPort={PROXY PORT}
systemProp.https.proxyUser={USERNAME}
systemProp.https.proxyPassword={PASSWORD}

This will cause either gradle or the wrapper to use the same configuration as your browser with the build, And there should be no issue downloading anymore.

George
  • 2,292
  • 2
  • 10
  • 21