small medium large xlarge

Generic-user-small
02 Nov 2014, 01:49
seadynamic8 (7 posts)

When I do:
Issues.GithubIssues.fetch( “elixir-lang” , “elixir” )

I’m getting this error:

iex(1)> Issues.GithubIssues.fetch("elixir-lang", "elixir")
** (exit) exited in: :gen_fsm.sync_send_all_state_event(#PID<0.137.0>, {:start, 5000}, :infinity)
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: ""
            (ssl) ssl_handshake.erl:1737: :ssl_handshake.dec_hello_extensions/2
            (ssl) ssl_handshake.erl:926: :ssl_handshake.decode_handshake/3
            (ssl) tls_handshake.erl:155: :tls_handshake.get_tls_handshake_aux/3
            (ssl) tls_connection.erl:433: :tls_connection.next_state/4
            (stdlib) gen_fsm.erl:503: :gen_fsm.handle_msg/7
            (stdlib) proc_lib.erl:237: :proc_lib.init_p_do_apply/3
     (stdlib) gen_fsm.erl:242: :gen_fsm.sync_send_all_state_event/3
        (ssl) ssl_connection.erl:1654: :ssl_connection.sync_send_all_state_event/2
        (ssl) ssl_connection.erl:101: :ssl_connection.handshake/2
        (ssl) tls_connection.erl:81: :tls_connection.start_fsm/8
        (ssl) ssl_connection.erl:71: :ssl_connection.connect/8
    (hackney) src/hackney_connect/hackney_connect.erl:219: :hackney_connect.do_connect/4
    (hackney) src/hackney_connect/hackney_connect.erl:30: :hackney_connect.connect/5
    (hackney) src/hackney_client/hackney.erl:301: :hackney.request/5
iex(1)>
21:22:34.750 [error] ** State machine #PID<0.137.0> terminating
** Last message in was {:tcp, #Port<0.5984>,
 <<22, 3, 3, 0, 93, 2, 0, 0, 89, 3, 3, 84, 85, 135, 92, 237, 90, 215, 20, 237, 164, 223, 17, 202, 132, 228, 130, 255, 245, 210, 252, 12, 210, 195, 10, 102, 48, 106, 83, 160, 132, 255, 210, 32, 32, 57, 236, 227, ...>>}
** When State == :hello
**      Data  == [data: [{'StateData',
   {:state, :client, {#Reference<0.0.0.958>, #PID<0.128.0>}, :gen_tcp,
    :tls_connection, :tcp, :tcp_closed, :tcp_error, 'api.github.com', 443,
    #Port<0.5984>,
    {:ssl_options, :tls, [{3, 3}, {3, 2}, {3, 1}, {3, 0}], :verify_none,
     {#Function<7.50551058/3 in :ssl.handle_verify_options/2>, []},
     #Function<8.50551058/1 in :ssl.handle_verify_options/2>, false, false,
     :undefined, 1, "", '***', "", '***', '***', '***', "", '***', :undefined,
     :undefined, '***', '***',
     [<<192, 36>>, <<192, 40>>, <<192, 38>>, <<192, 42>>, <<0, 107>>,
      <<0, 106>>, <<0, 61>>, <<192, 35>>, <<192, 39>>, <<192, 37>>, <<192, 41>>,
      <<0, 103>>, <<0, ...>>, <<...>>, ...],
     #Function<1.50551058/4 in :ssl.handle_options/1>, true, 268435456, false,
     :undefined, false, :undefined, :undefined, true, :undefined, false},
    {:socket_options, :binary, :raw, 0, 0, false}, '***', '***', '***', 49168,
    '***', 61463, :ssl_session_cache, {3, 3}, false, :undefined,
    {:undefined, :undefined}, :undefined, :undefined, '***', '***', '***',
    :undefined, '***', '***', '***', 53269, #Reference<0.0.0.961>, :undefined,
    '***', {false, :first}, {#PID<0.128.0>, #Reference<0.0.0.959>},
    #Reference<0.0.0.962>, {[], []}, false, true, false, false, :undefined,
    :undefined, :undefined}}]]
** Reason for termination =
** {{:badmatch, ""},
 [{:ssl_handshake, :dec_hello_extensions, 2,
   [file: 'ssl_handshake.erl', line: 1737]},
  {:ssl_handshake, :decode_handshake, 3,
   [file: 'ssl_handshake.erl', line: 926]},
  {:tls_handshake, :get_tls_handshake_aux, 3,
   [file: 'tls_handshake.erl', line: 155]},
  {:tls_connection, :next_state, 4, [file: 'tls_connection.erl', line: 433]},
  {:gen_fsm, :handle_msg, 7, [file: 'gen_fsm.erl', line: 503]},
  {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 237]}]}

It seems as if it may be a bug in OTP:
http://stackoverflow.com/questions/26090500/elixir-problems-with-https-urls
https://groups.google.com/forum/#!topic/elixir-lang-talk/xsAEzCfmRoQ

If it is, how can I figure out what version of OTP I’m using and how do I downgrade or patch it?

I didn’t get to the OTP section yet, so I don’t anything about it.

Any help? Thanks.

Jarvis

Giphy_pragsmall
02 Nov 2014, 19:39
☺ ☺ (7 posts)

Jarvis,

I had the exact same error on the exact same call from the exact same place in the book :-)

I simply uninstalled Erlang and installed the version with OTP 17.1 instead. That resolved the issue for me. The exact steps to uninstall and reinstall depends on your OS.

Note that the 17.1 version comes with Erlang 6.1 and not 6.2, so you may have to update your PATH.

Hope that helps,

Lars

Generic-user-small
02 Nov 2014, 22:48
seadynamic8 (7 posts)

Lars,

Thanks! It worked!

I was on Windows. I didn’t know it was as simple as uninstalling Erlang and reinstalling the new version. Great tip about updating the path.

A quick note, you need to handle the response as a tuple with either :ok or :error as the first item.

def handle_response({:ok, %{status_code: 200, body: body} }) do
  { :ok, body }
end
def handle_response({:error, %{reason: reason}) do
  { :error, reason }
end

Jarvis

Giphy_pragsmall
04 Nov 2014, 10:55
☺ ☺ (7 posts)

Glad it worked for you too! Thanks for the tip, I encountered the problem and put off debugging it. Now I don’t have to :)

You must be logged in to comment