onaio / fhir-gateway-extension

This repo holds the OpenSRP permissions checker and data access checker
Other
0 stars 1 forks source link

Add Support for HTTP POST Requests in RequestMutation #78

Closed lincmba closed 2 months ago

lincmba commented 3 months ago

Description:

We have previously encountered 400 errors when sending search requests to the JPA Server through the gateway-extensions. This issue was caused by the request size being too large. We resolved this by switching from GET to POST requests, as detailed in this issue: Switch to HTTP POST for FHIR Search Requests #73. This change handled all search requests where we used the fhirclient.

However, there are sections that use RequestMutation provided by the fhir-gateway dependency used by the gateway-extension. These sections were not updated, resulting in the same 400 errors as reported in this Sentry issue: Sentry Issue #49827.

To resolve this issue, two tasks are required:

  1. Support for POST Requests in the fhir-gateway Repository: Currently, the fhir-gateway does not support mutating HTTP POST requests. An open issue exists for this: Request Mutation for POST Requests #143. This support needs to be implemented in the fhir-gateway before changes can be made in the gateway-extensions repository.

  2. Implement Support for POST Requests in the gateway-extensions Repository: Once the fhir-gateway supports mutating HTTP POST requests, we need to update the gateway-extensions to handle these requests correctly.

Acceptance Criteria:

References:

lincmba commented 3 months ago

In handling the issue in the gateway-extensions repo, I have attempted to modify the verbs from GET to POST at the following locations:

However, these changes did not resolve the issue. Upon further investigation, I noticed that the client is being initialized using the transaction server instead of the search server:

According to the HAPI FHIR documentation, the transaction server does not support the .usingStyle(SearchStyleEnum.POST) method, which is available when using the search server. This could offer more insights on the issue, and we may need to explore alternative approaches to handle this properly.