Persistent connection errors to rubygems.org during bundle install with Depot

Issue Summary

I’m experiencing persistent connection failures to rubygems.org when deploying a Rails app using Depot builder. The build fails during bundle install with connection reset errors.

Environment

  • App region: nrt (Tokyo)
  • Builder region: IAD (recently changed to NRT, but issue persists)
  • My location: Australia (likely using Sydney Depot builder)
  • Rails version: 8.1.0
  • Ruby version: 3.4.4
  • Bundler version: 2.6.7

Error Message

Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/11): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
...
Retrying fetcher due to error (11/11): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <IOError: HTTP session not yet started (https://rubygems.org/specs.4.8.gz)>

Could not fetch specs from https://rubygems.org/ due to underlying error
<IOError: HTTP session not yet started (https://rubygems.org/specs.4.8.gz)>

What I’ve Tried

  1. Added retry and timeout configs to Dockerfile:

dockerfile

   RUN bundle config set --local retry 10 && \
       bundle config set --local timeout 60 && \
       bundle install

→ Still fails

  1. Changed App Builders region from IAD to NRT in Fly.io dashboard → No improvement

  2. Recreated the app machine (scale down to 0, then back to 1) → No change

  3. Multiple deployment attempts over several hours → Consistently fails

Workaround

Using --depot=false works perfectly:

bash

flyctl deploy --app app_name --image-label latest --depot=false

This suggests the issue is specific to Depot builder’s network connectivity to rubygems.org.

Question

Is there a known issue with Depot builder connectivity to rubygems.org from certain regions (possibly Sydney)?

Since I’m deploying from Australia, I suspect the Depot builder is running in the Sydney region and experiencing network issues reaching rubygems.org. Other users deploying from different regions might not encounter this problem.

Is there a way to:

  1. Force Depot builder to use a specific region?

  2. Debug which Depot builder region is actually being used?

  3. Or should I just stick with --depot=false as a permanent solution?

Any insights would be appreciated!

Hi - Nice LLM-generated diagnostic! The LLM almost got it right.

TL;DR your builder was still in iad, where we’ve seen some builders in iad (Depot or not) be blocked by code repositories hosted on the Fastly CDN. We’ve reported this to Fastly. In the meanwhile, using a Fly builder or relocating your Depot builder to a non-iad region via Sign in to Your Account · Fly → settings → builder should work.

I have relocated your Depot builder to ewr, let me know if it works better now. If not, using --depot=false is perfectly fine.

I see the LLM got a bit confused here: “likely using Sydney builder” but the builder was actually in iad and you said you changed it to NRT but when I went looking, it was still in iad?

Almost spot-on :slight_smile: Depot builders for Fly apps actually run on Fly machines, it’s not a separate network.

Let me know if things work better for you now!