Skip to content
New issue

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

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

Already on GitHub? # to your account

Error messages around user[data] and around ['data']['channel'] #526

Closed
dorel14 opened this issue Dec 17, 2021 · 6 comments
Closed

Error messages around user[data] and around ['data']['channel'] #526

dorel14 opened this issue Dec 17, 2021 · 6 comments

Comments

@dorel14
Copy link

dorel14 commented Dec 17, 2021

Hello
i migrate to lastest slack-machine and have a lot fo messages like these in my log file

[2021-12-17 12:09:13][ERROR] slack_sdk.rtm_v2 __init__.py:run_message_listeners:338 | Failed to run a message listener: 'data'
Traceback (most recent call last):
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack_sdk/rtm_v2/__init__.py", line 336, in run_message_listeners
    listener(self, message)
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack_sdk/rtm_v2/__init__.py", line 172, in new_message_listener
    func(_self, event)
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 147, in <lambda>
    self.rtm_client.on('user_change')(lambda client, event: self._on_user_change(client, event))
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 82, in _on_user_change
    user = self._register_user(payload['data']['user'])

Is this coming from one of my plugins ?

@repudi8or
Copy link
Contributor

in machine/clients/singletons/slack.py, the payload data structure seems to have changed... what was (payload['data']['user']) is now (payload['user']) .... at least for _on_user_change

@DonDebonair
Copy link
Owner

I will have a look at it. Is there any action in Slack that guarantees triggering this error, so I can reproduce?

@DonDebonair
Copy link
Owner

Also @dorel14 please use triple back-ticks next time so your stack trace is readable :)

Now you can see
Each line
Separately

@dorel14
Copy link
Author

dorel14 commented Feb 12, 2022

Here it is :) my logs are now well formatted

I think it is each time slack machine send a message and have to set a listener in case someone answer to this message

@dorel14 dorel14 changed the title Error messages around user[data] Error messages around user[data] and around ['data']['channel'] Feb 15, 2022
@dorel14
Copy link
Author

dorel14 commented Feb 15, 2022

Hi also have this kind of message when creating a new channel

[2022-02-15 09:20:34][ERROR] slack_sdk.rtm_v2 __init__.py:run_message_listeners:338 | Failed to run a message listener: 'data'
Traceback (most recent call last):
  File "/home/devsupportbot/lib/python3.6/site-packages/slack_sdk/rtm_v2/__init__.py", line 336, in run_message_listeners
    listener(self, message)
  File "/home/devsupportbot/lib/python3.6/site-packages/slack_sdk/rtm_v2/__init__.py", line 172, in new_message_listener
    func(_self, event)
  File "/home/devsupportbot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 126, in <lambda>
    lambda client, event: self._on_channel_created(client, event))
  File "/home/devsupportbot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 86, in _on_channel_created
    channel_resp = self.web_client.conversations_info(channel=payload['data']['channel']['id'])
KeyError: 'data'

@DonDebonair
Copy link
Owner

I fixed this in v0.25.0. Please upgrade

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants