appsignal / appsignal-elixir

🟪 AppSignal for Elixir package
https://www.appsignal.com/elixir
MIT License
285 stars 82 forks source link

Failed to download binary package when compile in docker. #949

Closed edwardzhou closed 4 months ago

edwardzhou commented 5 months ago

--

Describe the bug

we have a dockerized project. in the Dockerfile


COPY apps/graphql_web/mix.exs               apps/graphql_web/
COPY apps/leangoo/mix.exs                   apps/leangoo/
COPY apps/leangoo_db/mix.exs                apps/leangoo_db/
COPY apps/leangoo_file_service/mix.exs      apps/leangoo_file_service/
COPY apps/leangoo_file_service_web/mix.exs  apps/leangoo_file_service_web/
COPY apps/leangoo_pubsub_web/mix.exs        apps/leangoo_pubsub_web/
COPY apps/leangoo_rabbit/mix.exs            apps/leangoo_rabbit/
COPY apps/leangoo_reminder/mix.exs          apps/leangoo_reminder/
COPY apps/leangoo_reminder_web/mix.exs      apps/leangoo_reminder_web/
COPY apps/leangoo_web/mix.exs               apps/leangoo_web/
COPY apps/logger_file_backend/mix.exs       apps/logger_file_backend/
COPY apps/oauth_gateway/mix.exs             apps/oauth_gateway/
COPY apps/oauth_gateway_web/mix.exs         apps/oauth_gateway_web/
COPY config config

RUN no_proxy=192.168.0.100 mix deps.get \
    && mix deps.compile \
    && mix esbuild.install --if-missing

when docker build, it always failed with on mix deps.compile

==> appsignal
Downloading agent release
could not compile dependency :appsignal, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile appsignal --force", update it with "mix deps.update appsignal" or clean it with "mix deps.clean appsignal"
** (CaseClauseError) no case clause matching: []
    (hackney 1.20.1) /app/deps/hackney/src/hackney_url.erl:248: :hackney_url.parse_netloc/2
    (hackney 1.20.1) /app/deps/hackney/src/hackney.erl:691: :hackney.proxy_from_url/5
    (hackney 1.20.1) /app/deps/hackney/src/hackney.erl:335: :hackney.request/5
    mix_helpers.exs:229: Mix.Appsignal.Helper.do_download_file!/2
    mix_helpers.exs:199: anonymous fn/5 in Mix.Appsignal.Helper.do_download_file!/3
    (elixir 1.15.7) lib/enum.ex:4830: Enumerable.List.reduce/3
    (elixir 1.15.7) lib/enum.ex:2564: Enum.reduce_while/3
    mix_helpers.exs:166: Mix.Appsignal.Helper.download_package/2

But if I comment out the mix task


COPY apps/graphql_web/mix.exs               apps/graphql_web/
COPY apps/leangoo/mix.exs                   apps/leangoo/
COPY apps/leangoo_db/mix.exs                apps/leangoo_db/
COPY apps/leangoo_file_service/mix.exs      apps/leangoo_file_service/
COPY apps/leangoo_file_service_web/mix.exs  apps/leangoo_file_service_web/
COPY apps/leangoo_pubsub_web/mix.exs        apps/leangoo_pubsub_web/
COPY apps/leangoo_rabbit/mix.exs            apps/leangoo_rabbit/
COPY apps/leangoo_reminder/mix.exs          apps/leangoo_reminder/
COPY apps/leangoo_reminder_web/mix.exs      apps/leangoo_reminder_web/
COPY apps/leangoo_web/mix.exs               apps/leangoo_web/
COPY apps/logger_file_backend/mix.exs       apps/logger_file_backend/
COPY apps/oauth_gateway/mix.exs             apps/oauth_gateway/
COPY apps/oauth_gateway_web/mix.exs         apps/oauth_gateway_web/
COPY config config

# RUN no_proxy=192.168.0.100 mix deps.get \
#    && mix deps.compile \
#    && mix esbuild.install --if-missing

after build the image. enter it by manual

docker run --rm -it  <the_docker_image> /bin/bash

run the mix task by manual, it compiles always successfully

no_proxy=192.168.0.100 mix deps.get \
    && mix deps.compile \
    && mix esbuild.install --if-missing

I will fork and replace :hackney with :req to see can fix it.

To Reproduce

Steps to reproduce the behavior:

unflxw commented 5 months ago

Thanks for reporting this @edwardzhou!

It is perhaps related to this issue, though we do not use HTTPoison: https://github.com/edgurgel/httpoison/issues/328

Could you try removing no_proxy=192.168.0.100 from the RUN command in the Dockerfile and letting us know if that fixes the issue?

tombruijn commented 4 months ago

Didn't hear back. Closing. Let us know if we can still help.