IntegrityError when trying to use a non-object JSON as a configuration
Sentry Issue: ARKINDEX-BACKEND-WZ
CheckViolation: new row for relation "dataimport_workerconfiguration" violates check constraint "worker_configuration_configuration_objects"
DETAIL: Failing row contains (af89bb4d-eb58-46cf-aed4-cf0dd054974e, 2021-11-26 10:20:20.871556+00, 2021-11-26 10:20:20.871628+00, toast, [], d751713988987e9331980363e24189ce, a77f0e04-1d18-4b5b-b326-c48e0c176b36).
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
IntegrityError: new row for relation "dataimport_workerconfiguration" violates check constraint "worker_configuration_configuration_objects"
DETAIL: Failing row contains (af89bb4d-eb58-46cf-aed4-cf0dd054974e, 2021-11-26 10:20:20.871556+00, 2021-11-26 10:20:20.871628+00, toast, [], d751713988987e9331980363e24189ce, a77f0e04-1d18-4b5b-b326-c48e0c176b36).
(20 additional frame(s) were not displayed)
...
File "django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
cli.request('CreateWorkerConfiguration', id=WORKER_ID, body={
"name": "oh no",
"configuration": []
})
The database constraint works as expected and prevents the insertion of a non-object, but the API could at least have some validation by just using a DictField
…
Edited by Erwan Rouchet