BlakeWilliams/Elixir-Slack

fail to connect ws in Ubuntu

Closed this issue · 6 comments

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

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

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

@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

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

#137 offers to update websocket_client too

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