benoitc / hackney

simple HTTP client in Erlang
Other
1.34k stars 427 forks source link

Certifi module not found #528

Closed micke closed 5 years ago

micke commented 6 years ago

Getting this error when trying to use nostrum. I'm pretty new to elixir and the beam so not 100% sure if this is the right place to file this issue. From what i can gather it's the same issue as in #524. I've tried to override the certifi version in my mix.exs by using: {:certifi, "~> 2.4 and >= 2.4.2", override: true}.

I currently fix it by running mix deps.compile certifi. But it feels like a really dirty solution.

Elixir v1.7.3 Erlang 21

Erlang/OTP 21 [erts-10.0.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

[error] GenServer Ratelimiter terminating
** (UndefinedFunctionError) function :certifi.cacerts/0 is undefined (module :certifi is not available)
    (certifi) :certifi.cacerts()
    (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:296: :hackney_connect.ssl_opts_1/2
    (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:243: :hackney_connect.do_connect/5
    (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:37: :hackney_connect.connect/5
    (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney.erl:316: :hackney.request/5
    (httpoison) lib/httpoison/base.ex:439: HTTPoison.Base.request/9
    (nostrum) lib/nostrum/api/ratelimiter.ex:72: Nostrum.Api.Ratelimiter.do_request/1
    (nostrum) lib/nostrum/api/ratelimiter.ex:56: Nostrum.Api.Ratelimiter.handle_call/3
    (stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:690: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.286.0>): {:queue, %{body: "", headers: [{"content-type", "application/json"}], method: :get, options: [], route: "/gateway/bot"}, nil}
State: []
Client #PID<0.286.0> is alive

    (stdlib) gen.erl:169: :gen.do_call/4
    (elixir) lib/gen_server.ex:921: GenServer.call/3
    (nostrum) lib/nostrum/util.ex:154: Nostrum.Util.get_new_gateway_url/0
    (nostrum) lib/nostrum/shard/supervisor.ex:13: Nostrum.Shard.Supervisor.start_link/1
    (stdlib) supervisor.erl:379: :supervisor.do_start_child_i/3
    (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
    (stdlib) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
    (stdlib) supervisor.erl:1157: :supervisor.children_map/4
    (stdlib) supervisor.erl:315: :supervisor.init_children/2
    (stdlib) gen_server.erl:374: :gen_server.init_it/2
    (stdlib) gen_server.erl:342: :gen_server.init_it/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
** (Mix) Could not start application nostrum: Nostrum.Application.start(:normal, []) returned an error: shutdown: failed to start child: Nostrum.Shard.Supervisor
    ** (EXIT) exited in: GenServer.call(Ratelimiter, {:queue, %{body: "", headers: [{"content-type", "application/json"}], method: :get, options: [], route: "/gateway/bot"}, nil}, :infinity)
        ** (EXIT) an exception was raised:
            ** (UndefinedFunctionError) function :certifi.cacerts/0 is undefined (module :certifi is not available)
                (certifi) :certifi.cacerts()
                (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:296: :hackney_connect.ssl_opts_1/2
                (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:243: :hackney_connect.do_connect/5
                (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney_connect.erl:37: :hackney_connect.connect/5
                (hackney) /Users/lisinge/code/lisinge/munkey/deps/hackney/src/hackney.erl:316: :hackney.request/5
                (httpoison) lib/httpoison/base.ex:439: HTTPoison.Base.request/9
                (nostrum) lib/nostrum/api/ratelimiter.ex:72: Nostrum.Api.Ratelimiter.do_request/1
                (nostrum) lib/nostrum/api/ratelimiter.ex:56: Nostrum.Api.Ratelimiter.handle_call/3
                (stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
                (stdlib) gen_server.erl:690: :gen_server.handle_msg/6
                (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
glanotte commented 5 years ago

I just updated ale and haven't had the issue yet, looking at open issues over there. I think the issue might have been the mix linter, which is now disabled by default.

https://github.com/w0rp/ale/issues/2084

Very nice investigative work!

rupurt commented 5 years ago

OMG! Also just updated Ale and haven't seen the problem yet. Thank y'all so much!!!

benoitc commented 5 years ago

it seems an error due to tooling. Can anyone confirm so i can close this issue? I didn't reproduced it myself.

dalhorinek commented 5 years ago

@benoitc It seems so, I have not encountered the error since upgrading ALE to version, where mix formatter/linter is disabled.

benoitc commented 5 years ago

@dalhorinek ok

Closing the issue then as it doesn't seem related to the build of hackney. It can be reopened if needed. Thanks all for the feedback.

micke commented 5 years ago

@benoitc Thank you for your work and I'm sorry for having you spend time on debugging 👍 Really had no idea ale would be the culprit behind it all 😂