microsoft / fhir-server

A service that implements the FHIR standard
MIT License
1.15k stars 492 forks source link

History request in Bundle returns 404 #3821

Closed LodewijkSioen closed 2 months ago

LodewijkSioen commented 3 months ago

Describe the bug

FHIR Version? R4

Data provider? SQL Server

To Reproduce Create a patient resource and copy the ID.

This works:

GET Patient/{patientid}/_history

This doesn't

POST http://localhost:8080
Content-Type: application/json

{"resourceType":"Bundle","type":"batch","entry":[{"request":{"method":"GET","url":"Patient/{patientid}/_history"}}]}

Expected behavior I would expect a bundle with an entry containing a bundle with the history of the resource

Actual behavior

{
  "resourceType": "Bundle",
  "type": "batch-response",
  "entry": [
    {
      "response": {
        "status": "404",
        "outcome": {
          "resourceType": "OperationOutcome",
          "issue": [
            {
              "severity": "error",
              "code": "not-found",
              "diagnostics": "The route for \"/Task/fdcfb035-6dc3-421a-8675-415fc31f9fc7/_history\" was not found."
            }
          ]
        }
      }
    }
  ]
}

AB#119362

mikaelweave commented 3 months ago

Hi @LodewijkSioen! I just ran a quick test and confirmed I'm seeing this issue on my system. We're waiting for prioritation of the bug now.

brendankowitz commented 3 months ago

Quickly looked through the trace, looks like it matches 2 routes: Resource History, the correct route and CompartmentSearch. After that is goes into this method to resolve and ends up returning null. I'm wondering if it isn't evaluating the route parameter constraints either.

https://github.com/microsoft/fhir-server/blob/f9e520c29353b2327c7a51454a84266364ffdb48/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleRouter.cs#L117-L147

EXPEkesheth commented 2 months ago

@LodewijkSioen Closing as the issue is addressed