HTTP 500 on tags/attach API call

When things don't work as they should.
Post Reply
DrRSatzteil
Posts: 46
Joined: Mon Oct 26, 2020 11:38 pm

HTTP 500 on tags/attach API call

Post by DrRSatzteil »

Hi everyone,

I just discovered that my previously working code to attach some tags to a documents now fails with a 500 response code. By looking in the logs I see that some error is raised when I try to attach the tag:

Code: Select all

app_1                     | mayan.apps.logging.middleware.error_logging <508> [ERROR] "process_exception() line 17 Exception caught by request middleware; <WSGIRequest: POST '/api/v4/documents/852/tags/attach/'>, ErrorLogPartition matching query does not exist."
app_1                     | Traceback (most recent call last):
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
app_1                     |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
app_1                     |     return view_func(*args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
app_1                     |     return self.dispatch(request, *args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/rest_framework/views.py", line 509, in dispatch
app_1                     |     response = self.handle_exception(exc)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/rest_framework/views.py", line 469, in handle_exception
app_1                     |     self.raise_uncaught_exception(exc)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
app_1                     |     raise exc
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
app_1                     |     response = handler(request, *args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/rest_api/generics.py", line 84, in post
app_1                     |     return self.view_action(request, *args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/rest_api/generics.py", line 96, in view_action
app_1                     |     result = self.object_action(request=request, serializer=serializer)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/tags/api_views.py", line 92, in object_action
app_1                     |     tag.attach_to(document=self.object)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/events/decorators.py", line 29, in wrapper
app_1                     |     event_manager.commit()
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/events/classes.py", line 140, in commit
app_1                     |     self._commit()
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/events/classes.py", line 196, in _commit
app_1                     |     **self.get_event_arguments(argument_map=self.kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/events/classes.py", line 389, in commit
app_1                     |     action_object=action_object, target=target
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in send
app_1                     |     for receiver in self._live_receivers(sender)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>
app_1                     |     for receiver in self._live_receivers(sender)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/actstream/actions.py", line 135, in action_handler
app_1                     |     newaction.save(force_insert=True)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/base.py", line 744, in save
app_1                     |     force_update=force_update, update_fields=update_fields)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/base.py", line 793, in save_base
app_1                     |     update_fields=update_fields, raw=raw, using=using,
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in send
app_1                     |     for receiver in self._live_receivers(sender)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 175, in <listcomp>
app_1                     |     for receiver in self._live_receivers(sender)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_states/handlers.py", line 92, in handler_trigger_transition
app_1                     |     transition=valid_transitions[0]
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_states/models/workflow_instance_models.py", line 64, in do_transition
app_1                     |     transition=transition, user=user
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 668, in create
app_1                     |     return super(RelatedManager, self.db_manager(db)).create(**kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
app_1                     |     return getattr(self.get_queryset(), name)(*args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/query.py", line 422, in create
app_1                     |     obj.save(force_insert=True, using=self.db)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_states/models/workflow_instance_models.py", line 250, in save
app_1                     |     context=context, workflow_instance=self.workflow_instance
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/document_states/models/workflow_state_models.py", line 249, in execute
app_1                     |     self.error_log.all().delete()
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/mayan/apps/logging/classes.py", line 47, in method_instance_logs
app_1                     |     model_instance=self
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
app_1                     |     return getattr(self.get_queryset(), name)(*args, **kwargs)
app_1                     |   File "/opt/mayan-edms/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get
app_1                     |     self.model._meta.object_name
app_1                     | mayan.apps.logging.models.ErrorLogPartition.DoesNotExist: ErrorLogPartition matching query does not exist.
What's strange is that when I invoke the same call via the REST API in my browser I get a proper 200 response so theoretically it should be my code that is broken. However I was using it just fine until now and I cannot find any changes regarding this API in the changelogs nor in the API itself.... Any hints on what I'm doing wrong would be highly appreciated!
bwakkie
50 Posts
50 Posts
Posts: 73
Joined: Fri Feb 14, 2020 8:28 pm

Re: HTTP 500 on tags/attach API call

Post by bwakkie »

There was an issue reported about this with the same kind of log errors...

https://gitlab.com/mayan-edms/mayan-edms/-/issues/1069
Post Reply