BlakeWilliams/Elixir-Slack

Multiple Workspaces: App dies on `user_change` for user not in current workspace.

Closed this issue · 3 comments

adamu commented

I am working on a bot in a sandbox workspace that's in an Enterprise Grid with another workspace. I'm new to Elixir so forgive me if anything is unclear or inaccurate.

The sandbox webhook appears to receive user_change events for users that are not in the sandbox workspace (from the other enterprise workspace). When this happens the system goes down before the handle_event callback is called.

** Websocket client Slack.Bot terminating in :websocket_handle/3
   for the reason :error:{:badmap, nil}
** Websocket message was {:text, "{\"type\":\"user_change\",\"user\":{\"id\":...

There is a dump of the data received, but no stack trace so it's difficult to pinpoint what's going on. My guess is that Slack.State.update(%{type: "user_change", user: user}, slack) is failing?

I've checked the incoming user IDs, and the problem only occurs when the ID is not present in slack.users.

adamu commented

Oh I just noticed PR #156 already exists for this.

I can confirm that this is a critical issue with shared channels as well. Users that have the is_stranger: true field will crash the connection process

Just pushed 0.14.0 to fix this.