jwarlander / hedwig_hipchat

HipChat Adapter for Hedwig
MIT License
7 stars 5 forks source link

Cannot connect "no case clause matching stream:features" #3

Open dhanson358 opened 8 years ago

dhanson358 commented 8 years ago

Not sure where the issue is, if it's in this module, in hedwig-xmpp, or if it's just a problem with configuration.

Followed the README and have configured like this:

config :sln_halbot, SlnHalbot.Robot,
  adapter: Hedwig.Adapters.HipChat,
  name: "Halbot",
  aka: "!",
  jid: "215754_2680719@chat.hipchat.com",
  password: "<omitted>",
  rooms: [
    {"215754_software_dev@conf.hipchat.com", []}
  ],
  responders: [
    {Hedwig.Responders.Help, []},
    {Hedwig.Responders.Panzy, []},
    {Hedwig.Responders.GreatSuccess, []},
    {Hedwig.Responders.ShipIt, []}
  ]

When I run 'mix phoenix.start' or 'mix run --no-halt' I get this output & error:

[info] Established connection to chat.hipchat.com
[debug] [215754_2680719@chat.hipchat.com][OUTGOING] "<stream:stream to='chat.hipchat.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>"
[debug] [215754_2680719@chat.hipchat.com][INCOMING] {:xmlstreamstart, "stream:stream", [{"xmlns:stream", "http://etherx.jabber.org/streams"}, {"xmlns", "jabber:client"}, {"version", "1.0"}, {"from", "chat.hipchat.com"}, {"id", "0eb0f5039d5bae80"}]}
[info] Authenticating with PLAIN
[debug] [215754_2680719@chat.hipchat.com][OUTGOING] "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>OMITTED</auth>"
[debug] [215754_2680719@chat.hipchat.com][INCOMING] {:xmlel, "stream:features", [], [{:xmlel, "starttls", [{"xmlns", "urn:ietf:params:xml:ns:xmpp-tls"}], [{:xmlel, "required", [], []}]}]}
[error] GenServer #PID<0.528.0> terminating
** (CaseClauseError) no case clause matching: "stream:features"
    (romeo) lib/romeo/auth.ex:62: anonymous fn/2 in Romeo.Auth.success?/1
    (romeo) lib/romeo/auth.ex:32: Romeo.Auth.do_authenticate/2
    (romeo) lib/romeo/transports/tcp.ex:94: Romeo.Transports.TCP.authenticate/1
    (romeo) lib/romeo/transports/tcp.ex:54: Romeo.Transports.TCP.start_protocol/1
    (romeo) lib/romeo/connection.ex:84: Romeo.Connection.connect/2
    (connection) lib/connection.ex:623: Connection.enter_connect/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: %Romeo.Connection{features: %Romeo.Connection.Features{amp?: false, compression?: false, mechanisms: [], registration?: false, stream_management?: false, tls?: false}, host: nil, jid: "215754_2680719@chat.hipchat.com", nickname: "Halbot", owner: #PID<0.527.0>, parser: nil, password: "<omitted>", port: nil, preferred_auth_mechanisms: [], require_tls: false, resource: "", rooms: [{"215754_software_dev@conf.hipchat.com", []}], socket: nil, socket_opts: [], ssl_opts: [], timeout: 5000, transport: Romeo.Transports.TCP}

It just keeps repeating this every few seconds as it retries

Any ideas?

jwarlander commented 8 years ago

Hmm, I'll see if I can trigger the issue on my end; unfortunately I haven't seen it while working with our internal HipChat server, but I can set up a cloud account and try it out.

dhanson358 commented 8 years ago

After digging a bit more, it looks like this may be an issue with the Romeo project (or some misconfiguration):

https://github.com/scrogson/romeo/issues/7

scrogson commented 8 years ago

@dhanson358 can you see which version of romeo is getting pulled into your project? You may need to lock it down to 0.4.0 because hedwig_hipchat has not be updated to work with romeo v0.5.0

dhanson358 commented 8 years ago

I tried both 0.4.0 and 0.5.0. Same issue.

dhanson358 commented 8 years ago

I played with it some this morning, and I think what's happening is that Romeo is sending the "auth" request, but the next incoming message it gets is NOT the ack of the "auth", but an unrelated "stream:features" message. So it's trying to filter stream:features through it's authentication check routine, and it just doesn't match up.

dhanson358 commented 8 years ago

This looks like it's now fixed in romeo master, so once that gets rolled into a release, updating the dependency in the mix.exs should take care of it.

https://github.com/scrogson/romeo/issues/7