Unable able to deploy Rails app, deployment is timing out

The deployment of my Rails 7 app is timing out and I’m not sure why.

I have tried deleting my yarn.lock and running yarn --network-timeout 100000 but my deployment is still timing out

 => ERROR [node_modules 3/3] RUN yarn install                            162.8s
------
 > [node_modules 3/3] RUN yarn install:
#23 0.515 yarn install v1.22.19
#23 0.556 [1/4] Resolving packages...
#23 0.633 [2/4] Fetching packages...
#23 30.71 info There appears to be trouble with your network connection. Retrying...
#23 63.73 info There appears to be trouble with your network connection. Retrying...
#23 96.74 info There appears to be trouble with your network connection. Retrying...
#23 129.7 info There appears to be trouble with your network connection. Retrying...
#23 162.8 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#23 162.8 error An unexpected error occurred: "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.1.0.tgz: ETIMEDOUT".
#23 162.8 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c yarn install]: exit code: 1

Any ideas what could be causing this? Thanks in advance!

I tried another fix but adding yarn --network-timeout 100000 in my Dockerfile and rerunning fly deploy but it is still timing out

Full trace:

Update available 0.0.420 -> v0.0.423.
Run "fly version update" to upgrade.
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-green-sun-5066 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 8.4s (0/1)
[+] Building 513.7s (23/27)
 => [internal] load remote build context                                                                                     0.0s
 => copy /context /                                                                                                          0.1s
 => resolve image config for docker.io/docker/dockerfile:experimental                                                        0.4s
 => CACHED docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c0  0.0s
 => [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:3.0.2-jemalloc-slim                                            0.2s
 => [base 1/6] FROM quay.io/evl.ms/fullstaq-ruby:3.0.2-jemalloc-slim@sha256:a3cffbcdadc3bf81ebec5a9fe283d0bebb4cb7a950dc2fb  0.0s
 => CACHED [base 2/6] RUN mkdir /app                                                                                         0.0s
 => CACHED [base 3/6] WORKDIR /app                                                                                           0.0s
 => CACHED [base 4/6] RUN mkdir -p tmp/pids                                                                                  0.0s
 => CACHED [base 5/6] RUN curl https://get.volta.sh | bash                                                                   0.0s
 => CACHED [base 6/6] RUN volta install node@16.13.1 yarn                                                                    0.0s
 => CACHED [build_deps 1/1] RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=c  0.0s
 => CACHED [node_modules 1/3] COPY package*json ./                                                                           0.0s
 => CACHED [node_modules 2/3] COPY yarn.* ./                                                                                 0.0s
 => ERROR [node_modules 3/3] RUN yarn install --network-timeout 100000                                                     512.8s
 => CACHED [stage-4 1/9] RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=cac  0.0s
 => CACHED [gems 1/3] RUN gem update --system --no-document &&     gem install -N bundler -v 2.3.11                          0.0s
 => CACHED [gems 2/3] COPY Gemfile* ./                                                                                       0.0s
 => CACHED [gems 3/3] RUN bundle install &&  rm -rf vendor/bundle/ruby/*/cache                                               0.0s
 => CACHED [stage-4 2/9] COPY --from=gems /app /app                                                                          0.0s
 => CACHED [stage-4 3/9] COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions                    0.0s
 => CACHED [stage-4 4/9] COPY --from=gems /usr/local/bundle /usr/local/bundle                                                0.0s
 => CACHED [stage-4 5/9] COPY  config/parameter_sanitizer.rb /Users/ogarocious/.rvm/gems/ruby-3.0.2/gems/devise-4.8.1/lib/d  0.0s
------
 > [node_modules 3/3] RUN yarn install --network-timeout 100000:
#23 0.522 yarn install v1.22.19
#23 0.563 [1/4] Resolving packages...
#23 0.632 [2/4] Fetching packages...
#23 100.7 info There appears to be trouble with your network connection. Retrying...
#23 203.7 info There appears to be trouble with your network connection. Retrying...
#23 306.7 info There appears to be trouble with your network connection. Retrying...
#23 409.7 info There appears to be trouble with your network connection. Retrying...
#23 512.8 error An unexpected error occurred: "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz: ETIMEDOUT".
#23 512.8 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#23 512.8 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c yarn install --network-timeout 100000]: exit code: 1