Giter Site home page Giter Site logo

Machine crash about slack-machine HOT 5 CLOSED

dondebonair avatar dondebonair commented on May 16, 2024
Machine crash

from slack-machine.

Comments (5)

dorel14 avatar dorel14 commented on May 16, 2024

Hello again a crash this morning

127.0.0.1 - - [19/Jun/2020 09:14:23] "GET / HTTP/1.1" 200 8707
[2020-06-19 10:53:28][ERROR] slack.rtm.client client.py:_dispatch_event:445 | When calling '#_on_user_change()' in the 'machine.clients.singletons.slack' module the following error was raised: missing value for field "deleted"
Traceback (most recent call last):
  File "/home/supportbot/bot/lib/python3.6/site-packages/dacite/core.py", line 47, in from_dict
    field_data = data[field.name]
KeyError: 'deleted'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/supportbot/bot/lib/python3.6/site-packages/dacite/core.py", line 59, in from_dict
    value = get_default_value_for_field(field)
  File "/home/supportbot/bot/lib/python3.6/site-packages/dacite/dataclasses.py", line 21, in get_default_value_for_field
    raise DefaultValueNotFoundError()
dacite.dataclasses.DefaultValueNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/supportbot/bot/bin/slack-machine", line 10, in <module>
    sys.exit(main())
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/bin/run.py", line 14, in main
    bot.run()
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/core.py", line 211, in run
    self._dispatcher.start()
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/dispatch.py", line 34, in start
    self._client.start()
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 118, in start
    self.rtm_client.start()
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack/rtm/client.py", line 198, in start
    return self._event_loop.run_until_complete(future)
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack/rtm/client.py", line 339, in _connect_and_read
    await self._read_messages()
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack/rtm/client.py", line 390, in _read_messages
    await self._dispatch_event(event, data=payload)
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack/rtm/client.py", line 440, in _dispatch_event
    self._execute_in_thread(callback, data)
  File "/home/supportbot/bot/lib/python3.6/site-packages/slack/rtm/client.py", line 465, in _execute_in_thread
    future.result()
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  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'])
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/clients/singletons/slack.py", line 44, in _register_user
    user = User.from_api_response(user_response)
  File "/home/supportbot/bot/lib/python3.6/site-packages/machine/models/user.py", line 57, in from_api_response
    return from_dict(data_class=User, data=user_reponse)  # pragma: no cover
  File "/home/supportbot/bot/lib/python3.6/site-packages/dacite/core.py", line 63, in from_dict
    raise MissingValueError(field.name)
dacite.exceptions.MissingValueError: missing value for field "deleted"

from slack-machine.

dorel14 avatar dorel14 commented on May 16, 2024

@dandydev Again today

from slack-machine.

repudi8or avatar repudi8or commented on May 16, 2024

for these type of errors you can just make those fields in the user model optional.... ie in machine/models/user.py :-

@DataClass(frozen=True)
class User:
"""
User model that represents a user object from the Slack API
"""
id: str
team_id: Optional[str]
name: str
deleted: Optional[bool]

from slack-machine.

DonDebonair avatar DonDebonair commented on May 16, 2024

When generating the models, I also had a look at the API docs, which seemed to suggest that deleted was always present. Apparently not though, so I'll fix that.

from slack-machine.

DonDebonair avatar DonDebonair commented on May 16, 2024

You can upgrade to v0.20 to get the fixes

from slack-machine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.