onaio / fhir-gateway-extension

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

Bug 🐛 : Related Entity Location throwing errors on sync over missing permissions #47

Closed f-odhiambo closed 6 months ago

f-odhiambo commented 7 months ago

App throwing error :

2024-04-12 12:26:48.910 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /RelatedPerson. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:26:51.576 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Task. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:26:51.792 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Location. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:26:52.007 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Immunization. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:22.336 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Condition. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:22.562 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /CarePlan. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:22.791 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Group. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:23.023 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Observation. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:23.252 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Patient. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:23.723 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /QuestionnaireResponse. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:24.215 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /RelatedPerson. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:24.702 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Task. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:24.932 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Location. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:25.159 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Immunization. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:25.397 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Condition. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:25.629 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /CarePlan. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:25.860 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Group. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:26.139 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Observation. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:26.363 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Patient. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:26.965 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /QuestionnaireResponse. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:27.446 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /RelatedPerson. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:27.935 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Task. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:28.166 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Location. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:27:28.392 15630-15786 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Immunization. User assignment or sync strategy not configured correctly"}]}

Check in the following classes of code https://github.com/onaio/fhir-gateway-extension/blob/a9f3c0916650b9a79e097df95dc01[…]main/java/org/smartregister/fhir/gateway/plugins/Constants.java

Triage

  1. Check on user assignment and tagging of resources
  2. Check on user roles assigned to a group
  3. Check on app ID linked to user

TODO

f-odhiambo commented 7 months ago

Additional notes

  1. Only 20/2552 Locations for the Hierarchy are being synced to the app Most likely caused by the same error
--> GET https://gateway-sid.stage.opensrp.id/fhir/Location?_count=250&_sort=_lastUpdated
2024-04-12 12:28:35.088 15630-15805 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  <-- 500 https://gateway-sid.stage.opensrp.id/fhir/Location?_count=250&_sort=_lastUpdated (216ms)
2024-04-12 12:28:35.090 15630-15805 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  {"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"User un-authorized to GET /Location. User assignment or sync strategy not configured correctly"}]}
2024-04-12 12:28:35.327 15630-15678 FhirSyncWorker          org.smartregister.opensrp.sidBunda   D  Received result from worker Failed(exceptions=
f-odhiambo commented 7 months ago

Related fix to this issue is being tracked here https://github.com/opensrp/fhircore/pull/3125

SebaMutuku commented 7 months ago

What was done.

  1. Assign practitioners to CareTeam and location ID
  2. Add the following config to household registration Questionnaire launch workflow
    "linkIds": [
              {
                "linkId": "3f3ab03a-7a4a-11ee-b962-0242ac120002",
                "type": "LOCATION"
              }
            ]
  3. Change sync strategy from
     "syncStrategy": [
        "CareTeam"
     ]

    to

      "syncStrategy": [
        "RelatedEntityLocation"
      ]

Errors: All GET request to the server are failing. AN example is one shown below

D  --> GET https://gateway-sid.stage.opensrp.id/fhir/Immunization?patient.organization=0ccdf2b1-96f8-4aa1-981e-783fdfb5f536&_sort=_lastUpdated
2024-04-15 15:44:44.059 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  --> END GET
2024-04-15 15:44:44.352 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  <-- 400 https://gateway-sid.stage.opensrp.id/fhir/Immunization?patient.organization=0ccdf2b1-96f8-4aa1-981e-783fdfb5f536&_sort=_lastUpdated (292ms)
2024-04-15 15:44:44.353 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  date: Mon, 15 Apr 2024 12:44:23 GMT
2024-04-15 15:44:44.353 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  content-type: application/json;charset=UTF-8
2024-04-15 15:44:44.353 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  x-powered-by: HAPI FHIR 6.2.5 REST Server (FHIR Server; FHIR 4.0.1/R4)
2024-04-15 15:44:44.353 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  x-request-id: 4c6629c93fdc397fdabf03511ed3825f
2024-04-15 15:44:44.353 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  strict-transport-security: max-age=15724800; includeSubDomains
2024-04-15 15:44:44.355 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>
2024-04-15 15:44:44.355 31904-13430 QuestOkHttpClient       org.smartregister.opensrp.sidBunda   D  <-- END HTTP (435-byte body)
2024-04-15 15:44:44.358 31904-2036  DownloaderImpl$download org.smartregister.opensrp.sidBunda   E  retrofit2.HttpException: HTTP 400 
                                                                                                        at retrofit2.KotlinExtensions$await$2$2.onResponse(KotlinExtensions.kt:53)
                                                                                                        at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:161)
                                                                                                        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
lincmba commented 6 months ago

@SebaMutuku , I believe this was resolved, kindly confirm

SebaMutuku commented 6 months ago

@lincmba Will test and revert. Are there any server changes that might need to be deployed?

f-odhiambo commented 6 months ago

Closing this issue as resolved for now after further testing