penny-university / penny_university

5 stars 6 forks source link

/penny chat command error with saying PennyChatInvitation matching query does not exist. #216

Closed changhsinlee closed 4 years ago

changhsinlee commented 4 years ago

See how I got the error in action 👇 https://youtu.be/yHdsM2AD2yI

Error message

In the Heroku log


2020-05-14T01:06:42.681574+00:00 app[web.1]: Internal Server Error: /bot/interactive/
2020-05-14T01:06:42.681582+00:00 app[web.1]: Traceback (most recent call last):
2020-05-14T01:06:42.681583+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-14T01:06:42.681584+00:00 app[web.1]: response = get_response(request)
2020-05-14T01:06:42.681585+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
2020-05-14T01:06:42.681585+00:00 app[web.1]: response = self.process_exception_by_middleware(e, request)
2020-05-14T01:06:42.681586+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
2020-05-14T01:06:42.681586+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
2020-05-14T01:06:42.681587+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/clickjacking.py", line 50, in wrapped_view
2020-05-14T01:06:42.681587+00:00 app[web.1]: resp = view_func(*args, **kwargs)
2020-05-14T01:06:42.681587+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
2020-05-14T01:06:42.681588+00:00 app[web.1]: return view_func(*args, **kwargs)
2020-05-14T01:06:42.681588+00:00 app[web.1]: File "/app/bot/views.py", line 49, in interactive
2020-05-14T01:06:42.681589+00:00 app[web.1]: resp = bot(event)
2020-05-14T01:06:42.681589+00:00 app[web.1]: File "/app/bot/processors/base.py", line 161, in __call__
2020-05-14T01:06:42.681590+00:00 app[web.1]: resp = event_processor(event)
2020-05-14T01:06:42.681590+00:00 app[web.1]: File "/app/bot/processors/base.py", line 203, in __call__
2020-05-14T01:06:42.681590+00:00 app[web.1]: resp = getattr(self, processor)(event)
2020-05-14T01:06:42.681591+00:00 app[web.1]: File "/app/bot/processors/base.py", line 113, in wrapped_processor
2020-05-14T01:06:42.681591+00:00 app[web.1]: return processor(self_or_class, event=event)
2020-05-14T01:06:42.681591+00:00 app[web.1]: File "/app/bot/processors/base.py", line 113, in wrapped_processor
2020-05-14T01:06:42.681592+00:00 app[web.1]: return processor(self_or_class, event=event)
2020-05-14T01:06:42.681592+00:00 app[web.1]: File "/app/bot/processors/pennychat.py", line 286, in channel_select
2020-05-14T01:06:42.681593+00:00 app[web.1]: penny_chat_invitation = PennyChatInvitation.objects.get(view=event['view']['id'])
2020-05-14T01:06:42.681593+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
2020-05-14T01:06:42.681594+00:00 app[web.1]: return getattr(self.get_queryset(), name)(*args, **kwargs)
2020-05-14T01:06:42.681594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get
2020-05-14T01:06:42.681594+00:00 app[web.1]: self.model._meta.object_name
2020-05-14T01:06:42.681595+00:00 app[web.1]: pennychat.models.PennyChatInvitation.DoesNotExist: PennyChatInvitation matching query does not exist.
2020-05-14T01:06:42.681702+00:00 app[web.1]: Internal Server Error: /bot/interactive/
2020-05-14T01:06:42.681703+00:00 app[web.1]: Traceback (most recent call last):
2020-05-14T01:06:42.681704+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-14T01:06:42.681704+00:00 app[web.1]: response = get_response(request)
2020-05-14T01:06:42.681704+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
2020-05-14T01:06:42.681705+00:00 app[web.1]: response = self.process_exception_by_middleware(e, request)
2020-05-14T01:06:42.681705+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
2020-05-14T01:06:42.681706+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
2020-05-14T01:06:42.681706+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/clickjacking.py", line 50, in wrapped_view
2020-05-14T01:06:42.681707+00:00 app[web.1]: resp = view_func(*args, **kwargs)
2020-05-14T01:06:42.681707+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
2020-05-14T01:06:42.681708+00:00 app[web.1]: return view_func(*args, **kwargs)
2020-05-14T01:06:42.681708+00:00 app[web.1]: File "/app/bot/views.py", line 49, in interactive
2020-05-14T01:06:42.681708+00:00 app[web.1]: resp = bot(event)
2020-05-14T01:06:42.681709+00:00 app[web.1]: File "/app/bot/processors/base.py", line 161, in __call__
2020-05-14T01:06:42.681709+00:00 app[web.1]: resp = event_processor(event)
2020-05-14T01:06:42.681710+00:00 app[web.1]: File "/app/bot/processors/base.py", line 203, in __call__
2020-05-14T01:06:42.681710+00:00 app[web.1]: resp = getattr(self, processor)(event)
2020-05-14T01:06:42.681711+00:00 app[web.1]: File "/app/bot/processors/base.py", line 113, in wrapped_processor
2020-05-14T01:06:42.681711+00:00 app[web.1]: return processor(self_or_class, event=event)
2020-05-14T01:06:42.681711+00:00 app[web.1]: File "/app/bot/processors/base.py", line 113, in wrapped_processor
2020-05-14T01:06:42.681712+00:00 app[web.1]: return processor(self_or_class, event=event)
2020-05-14T01:06:42.681712+00:00 app[web.1]: File "/app/bot/processors/pennychat.py", line 286, in channel_select
2020-05-14T01:06:42.681713+00:00 app[web.1]: penny_chat_invitation = PennyChatInvitation.objects.get(view=event['view']['id'])
2020-05-14T01:06:42.681713+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
2020-05-14T01:06:42.681713+00:00 app[web.1]: return getattr(self.get_queryset(), name)(*args, **kwargs)
2020-05-14T01:06:42.681714+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get
2020-05-14T01:06:42.681714+00:00 app[web.1]: self.model._meta.object_name
2020-05-14T01:06:42.681715+00:00 app[web.1]: pennychat.models.PennyChatInvitation.DoesNotExist: PennyChatInvitation matching query does not exist.

How to reproduce

Even deletion of db.sqlite3 and migration doesn't fix it.

Still trying to figure out what is going on, but here's one sqlite3 db file that was giving me issues:

db.zip

The penny chats I tried seem to have been saved to the database:

image

changhsinlee commented 4 years ago

Not a bug, needs to run ./manage.py background_tasks during development to get /penny chat to work.

changhsinlee commented 4 years ago

Updated dev document to reflect the change