maykinmedia / archiefbeheercomponent

An application for record management
Other
2 stars 1 forks source link

Add Accept-Csr head in client #349

Closed joeribekker closed 4 months ago

joeribekker commented 4 months ago

Currently, cases cannot be created because of this missing header.

[2024-06-19 10:48:00,417: ERROR/ForkPoolWorker-15] Task archiefbeheercomponent.destruction.tasks.create_destruction_zaak[d0d0e372-944a-46ff-a7a1-f912736b4e04] raised unexpected: ClientError({'type': 'XXX/ref/fouten/PreconditionFailed/', 'code': 'precondition_failed', 'title': 'Voorwaarde is niet vervuld', 'status': 412, 'detail': "'Accept-Crs' header ontbreekt", 'instance': 'urn:uuid:99211fdf-1027-4249-b2bd-137955e73432'})
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/zds_client/client.py", line 233, in request
    response.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 412 Client Error: Precondition Failed for url: XXX/zaken/api/v1/zaken

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 257, in _inner
    reraise(*exc_info)
  File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 60, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 252, in _inner
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
  File "/app/src/archiefbeheercomponent/destruction/tasks.py", line 333, in create_destruction_zaak
    destruction_zaak = zrc_client.create(
  File "/usr/local/lib/python3.8/site-packages/zds_client/client.py", line 303, in create
    return self.request(
  File "/usr/local/lib/python3.8/site-packages/zgw_consumers/client.py", line 90, in request
    return super().request(
  File "/usr/local/lib/python3.8/site-packages/zds_client/client.py", line 237, in request
    raise ClientError(response_json) from exc
zds_client.client.ClientError: {'type': 'XXX/ref/fouten/PreconditionFailed/', 'code': 'precondition_failed', 'title': 'Voorwaarde is niet vervuld', 'status': 412, 'detail': "'Accept-Crs' header ontbreekt", 'instance': 'urn:uuid:99211fdf-1027-4249-b2bd-137955e73432'}
joeribekker commented 4 months ago

This might be fixed in newer versions of zgw consumers? unsure.