BlakeWilliams / Elixir-Slack

Slack real time messaging and web API client in Elixir
MIT License
674 stars 182 forks source link

fail to connect ws in Ubuntu #133

Closed tt67wq closed 7 years ago

tt67wq commented 7 years ago

code works well in Mac osx but failed in Ubuntu exception shows:

** (Mix) Could not start application ebot: Ebot.Application.start(:normal, []) returned an error: shutdown: failed to start child: Slack.Bot
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:undef, [{:crypto, :rand_bytes, [16], []}, {:wsc_lib, :generate_ws_key, 0, [file: '/data/ebot/ebot/deps/websocket_client/src/wsc_lib.erl', line: 227]}, {:websocket_client, :init, 1, [file: '/data/ebot/ebot/deps/websocket_client/src/websocket_client.erl', line: 158]}, {:gen_fsm, :init_it, 6, [file: 'gen_fsm.erl', line: 348]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}}
            (slack) lib/slack/bot.ex:40: Slack.Bot.start_link/4
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:348: :supervisor.start_children/3
            (stdlib) supervisor.erl:314: :supervisor.init_children/2
            (stdlib) gen_server.erl:365: :gen_server.init_it/2
            (stdlib) gen_server.erl:333: :gen_server.init_it/6
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
tt67wq commented 7 years ago

I've already install erlang-crypto am I missing other dependencis?

BlakeWilliams commented 7 years ago

What versions of Elixir, Erlang, and Ubuntu are you running?

bsnyder788 commented 7 years ago

@BlakeWilliams I am seeing the same exact errors after upgrading to elixir 1.4.5 and Erlang/OTP 20 [erts-9.0] on Ubuntu 14.04.

It was working fine on elixir 1.4.4 and Erlang/OTP 19.

I could work past the error by editing wsc_lib.erl line 171 and 227 and replacing crypto:rand_bytes with crypto:strong_rand_bytes on each line..but more errors follow after those changes

ne1ro commented 7 years ago

I guess it's time to upgrade https://github.com/jeremyong/websocket_client dependency. The issue was already fixed in this commit .

ivanovaleksey commented 7 years ago

137 offers to update websocket_client too

BlakeWilliams commented 7 years ago

Just pushed 0.12.0 that has #138. Feel free to reopen if that doesn't fix it.