Open aditya-07 opened 2 years ago
@jingtang10
I have exactly the same problem. Any update on this? Thank you!
Seems like this is to do with the etag being escaped?
@tadgh This seems to work fine now on the latest hapi server. Could you please confirm that it has been fixed and maybe the version where it got fixed?
I tried updating a Patient and it seems to work fine.
POST https://hapi.fhir.org/baseR4/
Content-Type: application/fhir+json; charset=utf-8
Content-Length: 404
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "Patient/11370346",
"resource": {
"resourceType": "Binary",
"contentType": "application/json-patch+json",
"data": "W3sib3AiOiJhZGQiLCJwYXRoIjoiXC9hY3RpdmUiLCJ2YWx1ZSI6dHJ1ZX0seyJvcCI6InJlcGxhY2UiLCJwYXRoIjoiXC90ZWxlY29tXC8wXC92YWx1ZSIsInZhbHVlIjoiMTIzNDU2Nzg5MSJ9XQ=="
},
"request": {
"method": "PATCH",
"url": "Patient/11370346",
"ifMatch": "W/\"3\""
}
}
]
}
--> END POST (404-byte body)
200 OK https://hapi.fhir.org/baseR4/ (357ms)
Server: nginx/1.18.0 (Ubuntu)
Date: Wed, 01 Nov 2023 09:16:58 GMT
Content-Type: application/fhir+json;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: HAPI FHIR 6.9.5-SNAPSHOT/7e3c42549d/2023-09-09 REST Server (FHIR Server; FHIR 4.0.1/R4)
X-Request-ID: rsa60y5IdEEyqQPS
Content-Location: https://hapi.fhir.org/baseR4/Bundle/5543c581-7333-42b2-97e7-b5ef79c05349
Location: https://hapi.fhir.org/baseR4/Bundle/5543c581-7333-42b2-97e7-b5ef79c05349
{
"resourceType": "Bundle",
"id": "5543c581-7333-42b2-97e7-b5ef79c05349",
"type": "transaction-response",
"link": [
{
"relation": "self",
"url": "https://hapi.fhir.org/baseR4"
}
],
"entry": [
{
"response": {
"status": "200 OK",
"location": "Patient/11370346/_history/4",
"etag": "4",
"lastModified": "2023-10-20T07:14:14.707+00:00",
"outcome": {
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">INFORMATION</td><td>[]</td><td>Successfully patched resource "Patient/11370346/_history/4".</td></tr></table></div>"
},
"issue": [
{
"severity": "information",
"code": "informational",
"details": {
"coding": [
{
"system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code",
"code": "SUCCESSFUL_PATCH",
"display": "Patch succeeded."
}
]
},
"diagnostics": "Successfully patched resource \"Patient/11370346/_history/4\"."
}
]
}
}
}
]
}
<-- END HTTP (1253-byte body)
as per aditya's last comment this should have been closed? @tadgh can you pls confirm?
One moment, checking the code :)
@aditya-07 @jingtang10 Just to be totally safe, I'm going to write a quick test. Beyond the original transaction in the OP, is there anything else I need to setup? Once I have a test I'll run a quick bisect and let you know where it got fixed.
I have a test replicating success on master. see here: https://github.com/hapifhir/hapi-fhir/pull/6139 I will bisect from here, assuming the test I've written is sufficiently representative for you?
I see that 6.0.0 is the first official version we know this does not work in, I'll start my bisect from there.
thanks very much gary!
Looks like its still broken on 6.2.0, working on 6.4.0! The bisect is painful because of how many architectural changes have gone in between 6_0_0 and _7_4_0. Standby for the exact fix...
Fix was here: 10615eb64c3def3a9f33851e1f1114aa27b8c44c https://github.com/hapifhir/hapi-fhir/pull/4416
Here is the full git bisect:
❯ git bisect log
git bisect start '--term-new=fixed' '--term-old=unfixed'
# status: waiting for both good and bad commits
# fixed: [428acff31bdb495148f5da2cd5228920daf60f74] 6.4.0 Mergeback (#4563)
git bisect fixed 428acff31bdb495148f5da2cd5228920daf60f74
# status: waiting for good commit(s), bad commit known
# unfixed: [43ed8ca0512c4cd921260b275a65e044a8964cd6] Issue 4052 addition of properties to the loinc terminology uploading process (#4100)
git bisect unfixed 43ed8ca0512c4cd921260b275a65e044a8964cd6
# unfixed: [c7d991c34554a132e54a8978559523346d7df13f] Disallow matching a resource to more than one golden record (#4344)
git bisect unfixed c7d991c34554a132e54a8978559523346d7df13f
# fixed: [7a31860376a623280d74f3695628c6e3826302b9] Improve query count accuracy (#4424)
git bisect fixed 7a31860376a623280d74f3695628c6e3826302b9
# unfixed: [155b579093d0948c8f58b35d7a96b61170db5a07] 4000 - Added some comments to the various loincupload.properties files to clarify that the Hierarchy filename was changed for v2.73. (#4382)
git bisect unfixed 155b579093d0948c8f58b35d7a96b61170db5a07
# unfixed: [6bd7f7a0e1150af3bc8ccc21e4ec823a6153afc7] PackageInstallerSvcImpl Says R4 is NOT Compatible with R4B (#4396)
git bisect unfixed 6bd7f7a0e1150af3bc8ccc21e4ec823a6153afc7
# unfixed: [02de3e49e39e3e9c7481e0e26df9d9e788971be4] Fix some issues with 'mvn test' on windows (#4223)
git bisect unfixed 02de3e49e39e3e9c7481e0e26df9d9e788971be4
# fixed: [65bf8d47ce31329b22162723008067472a342400] Prevent chunk from returning to in-progress unless it is errorred, in… (#4417)
git bisect fixed 65bf8d47ce31329b22162723008067472a342400
# fixed: [84d83f623044db0e051c15200b533342f00e8c7a] Restored a couple of the Unit Tests in ca.uhn.fhir.jpa.stresstest.StressTestR4Test.java (#4413)
git bisect fixed 84d83f623044db0e051c15200b533342f00e8c7a
# fixed: [10615eb64c3def3a9f33851e1f1114aa27b8c44c] Fix contention aware patch in transaction (#4416)
git bisect fixed 10615eb64c3def3a9f33851e1f1114aa27b8c44c
# first fixed commit: [10615eb64c3def3a9f33851e1f1114aa27b8c44c] Fix contention aware patch in transaction (#4416)
NOTE: Before filing a ticket, please see the following URL: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help
Describe the bug Including ifMatch with etag value for a PATCH request inside a Bundle transaction causes the transaction to fail. PUT on the other hand works fine.
FYI: Non Bundle Http Patch request against the Patient works fine though.
Failing PATCH request
Response
Working PUT Request
Response
To Reproduce Steps to reproduce the behavior:
POST
request to the https://hapi.fhir.org/baseR4/ and see the response.Expected behavior Transaction should be successful of if ifMatch has the latest value or fail gracefully for the right reason if the etag provided is not the latest one on the server just like the PUT operation . e.g. Like the PUT response above.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information): http://hapi.fhir.org/baseR4 HAPI FHIR Test/Demo Server R4 Endpoint HAPI FHIR Server 6.0.0-PRE8-SNAPSHOT/3f58e277e6/2022-03-23
Additional context Add any other context about the problem here.