Skip to content

KeyError when opening ApplyProcessTemplate in a web browser

Sentry Issue: ARKINDEX-BACKEND-XF

KeyError: 'process_id'
(6 additional frame(s) were not displayed)
...
  File "rest_framework/renderers.py", line 554, in get_raw_data_form
    serializer = view.get_serializer()
  File "rest_framework/generics.py", line 109, in get_serializer
    kwargs.setdefault('context', self.get_serializer_context())
  File "arkindex/dataimport/api.py", line 1659, in get_serializer_context
  File "rest_framework/generics.py", line 99, in get_object
    self.check_object_permissions(self.request, obj)
  File "arkindex/dataimport/api.py", line 1643, in check_object_permissions
  1. Create a template
  2. Get its UUID
  3. Open /api/v1/process/<template id>/ in your browser
  4. Enjoy the HTTP 500!

Maybe the object permission validation needs to be moved to a field with a custom validation on the serializer itself: this would avoid the use of request.data, which bypasses the serializer.

Edited by Erwan Rouchet