Timeout during mix deps.get

Hello,

I’m trying to run an Elixir Phoenix application but keep bumping in to a timeout error (or unknown package error, it’s not exactly clear) when running mix deps.get --only prod. I have tried:

  1. With a brand new blank Phoenix application
  2. With and without a database
  3. With and without --remote-only
  4. In different regions

Here’s the full stack trace:

 => ERROR [builder  6/17] RUN mix deps.get --only prod                                                                                                 16.6s
------                                                                                                                                                       
 > [builder  6/17] RUN mix deps.get --only prod:
#15 16.53 Failed to check for new Hex version
#15 16.53 Failed to fetch record for 'hexpm/html_entities' from registry (using cache instead)
#15 16.53 :timeout
#15 16.53 :timeout
#15 16.53 Failed to fetch record for 'hexpm/cowboy_telemetry' from registry (using cache instead)
#15 16.53 :timeout
#15 16.53 Failed to fetch record for 'hexpm/cowlib' from registry (using cache instead)
#15 16.53 :timeout
#15 16.53 Failed to fetch record for 'hexpm/esbuild' from registry (using cache instead)
#15 16.53 :timeout
#15 16.53 Failed to fetch record for 'hexpm/castore' from registry (using cache instead)
#15 16.54 :timeout
#15 16.54 Failed to fetch record for 'hexpm/cowboy' from registry (using cache instead)
#15 16.54 :timeout
#15 16.54 Failed to fetch record for 'hexpm/file_system' from registry (using cache instead)
#15 16.54 :timeout
#15 16.54 Failed to fetch record for 'hexpm/floki' from registry (using cache instead)
#15 16.54 :timeout
#15 16.54 ** (Mix) Unknown package castore in lockfile
------
Error error building: executor failed running [/bin/sh -c mix deps.get --only $MIX_ENV]: exit code: 1

I am simply running fly launch locally according to the help docs.

Does anyone have any ideas for getting around this?

Are you running Docker locally? --remote-only is the default if there’s no local Docker daemon. If you are running Docker locally, though, this likely means hex was having difficulties when you tried to do your builds.

No I’m not running Docker locally. I can confirm also that the logs suggest a remote builder is being used " => [internal] load remote build context"

Still receiving the same error this morning. Do you have any other suggestions?

I tried to do some debugging in the Dockerfile and thought this was a bit bizarre. When I add the line RUN curl https://repo.hex.pm/installs/hex-1.x.csv to check whether hex.pm is available from the builder (it is), the error now changes and installing mix itself appears to fail:

 => ERROR [builder  5/19] RUN mix local.hex --force &&     mix local.rebar --force                                                                     60.7s 
------
 > [builder  5/19] RUN mix local.hex --force &&     mix local.rebar --force:
#14 60.70 ** (Mix) request timed out after 60000ms
#14 60.70 
#14 60.70 Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.
#14 60.70 
#14 60.70 Alternatively, you can compile and install Hex directly with this command:
#14 60.70 
#14 60.70     mix archive.install github hexpm/hex branch latest
#14 60.70 
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c mix local.hex --force &&     mix local.rebar --force]: exit code: 1

This now seems to be working. I deleted the builder (twice, the second had the same problem) and the build now works OK :person_shrugging:

I had the same issue. Deleting the builder got it working :person_shrugging: