Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack has deprecated the RTM API, and it won't work with new apps (error msg: {:error, :no_scheme}) #21

Open
JediLuke opened this issue Mar 17, 2022 · 0 comments

Comments

@JediLuke
Copy link

If you make a new Slack app and try to use Hedwig, it won't work, you'll just get this very confusing error:

[error] GenServer #PID<0.592.0> terminating
** (MatchError) no match of right hand side value: {:error, :no_scheme}
    (hedwig_slack 1.0.0) lib/hedwig_slack/connection.ex:16: HedwigSlack.Connection.start/1
    (hedwig_slack 1.0.0) lib/hedwig_slack/adapter.ex:48: Hedwig.Adapters.Slack.handle_info/2
    (stdlib 3.15.2) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.15.2) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:EXIT, #PID<0.590.0>, {{:badmatch, {:error, :no_scheme}}, [{HedwigSlack.Connection, :start, 1, [file: 'lib/hedwig_slack/connection.ex', line: 16]}, {Hedwig.Adapters.Slack, :handle_info, 2, [file: 'lib/hedwig_slack/adapter.ex', line: 48]}, {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 695]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 771]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}}
State: {:state, {#PID<0.592.0>, Supervisor.Default}, :simple_one_for_one, {[Hedwig.Responder], %{Hedwig.Responder => {:child, :undefined, Hedwig.Responder, {Hedwig.Responder, :start_link, []}, :transient, false, 5000, :worker, [Hedwig.Responder]}}}, {:maps, %{#PID<0.593.0> => [Hedwig.Responders.Help, {nil, "DubzCat", [], #PID<0.590.0>}], #PID<0.594.0> => [Hedwig.Responders.Ping, {nil, "DubzCat", [], #PID<0.590.0>}], #PID<0.595.0> => [DubzCat.Responders.Meow, {nil, "DubzCat", [], #PID<0.590.0>}]}}, 3, 5, [], 0, :never, Supervisor.Default, {:ok, {%{intensity: 3, period: 5, strategy: :simple_one_for_one}, [{Hedwig.Responder, {Hedwig.Responder, :start_link, []}, :transient, 5000, :worker, [Hedwig.Responder]}]}}}

The issue is that Slack has deprecated the RTM API, in favour of the Events API - see https://api.slack.com/authentication/basics

If you use IO.inspect on the data you get back here https://github.com/hedwig-im/hedwig_slack/blob/master/lib/hedwig_slack/adapter.ex#L45

you'll see %{"error" => "invalid_auth", "ok" => false}

I think the only way to fix this for new apps (my old app seems to still work) will be to upgrade this adapter to not use the RTM API

@JediLuke JediLuke changed the title Slack has deprecated the RTM API, and it won't work with new apps Slack has deprecated the RTM API, and it won't work with new apps (error msg: {:error, :no_scheme}` Mar 17, 2022
@JediLuke JediLuke changed the title Slack has deprecated the RTM API, and it won't work with new apps (error msg: {:error, :no_scheme}` Slack has deprecated the RTM API, and it won't work with new apps (error msg: {:error, :no_scheme}) Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant