client-js icon indicating copy to clipboard operation
client-js copied to clipboard

Uncaught (in promise) Error: Failed to fetch the conformance statement from "https://staging-fhir.ecwcloud.com/fhir/r4/FFBJCD/metadata". TypeError: Network request failed

Open msohaib308 opened this issue 2 years ago • 6 comments
trafficstars

I am having XML response issue

fhirClient is expecting JSON format but fhir server is returning XML here is the fhir server URLs

https://staging-fhir.ecwcloud.com/fhir/r4/FFBJCD/metadata https://staging-fhir.ecwcloud.com/fhir/r4/FFBJCD/.well-known/smart-configuration

Fhir server provide extra query parameter "_format=json" to get JSON response, this option is only for metadata but they did not provide this option for "smart-configuration" end point

I don't know how to set this ("_format=json" ) configuration in fhirCLient Library.

https://staging-fhir.ecwcloud.com/fhir/r4/FFBJCD/metadata?_format=json

Screenshot 2023-03-31 124304

Is there any option to accept XML responses

msohaib308 avatar Mar 31 '23 07:03 msohaib308

The client does NOT support XML but it sends and accept: application/json header on each request to tell the server how to respond. This seems to work fine with your server.

As the screenshot shows, the problem is not there. You just need to configure / modify your FHIR server to support CORS.

vlad-ignatov avatar Mar 31 '23 15:03 vlad-ignatov

Issue is the XML response type

Anyway if i can handle on client side Because FHIR server is owned by third party

msohaib308 avatar Apr 01 '23 05:04 msohaib308

If you try loading those URLs in a browser window you will get back XML. That is because browsers send some accept headers by default. Otherwise you would get JSON, even if you don't send any accept header. Don't let that trick you into thinking that XML is the issue - in this case what you see is not what you get :)

Every FHIR server MUST support CORS. Otherwise it would be unusable (even if you didn't need to authenticate). You can't work around this from the client side and that is exactly the point of CORS - clients should be rejected unless server admins say they shouldn't.

Your only choice is to let them know that CORS must be enabled and perhaps send them that screenshot for reference.

vlad-ignatov avatar Apr 01 '23 14:04 vlad-ignatov

Is this resolve? @msohaib308 Can you please guide me on this?

zamananjum0 avatar Sep 27 '23 12:09 zamananjum0

Hy @zamananjum0

Issue is not resolved yet however they suggested to try implementation on backend side Below is the email that i got from ECW Team

image

msohaib308 avatar Sep 27 '23 13:09 msohaib308

Did the 21st Century Act require SMART on FHIR apps by EHRs for EHR-launch require it to be browser-based? Like is this allowable behavior that eCW can argue CORS whitelisting as an "enhancement request" if @vlad-ignatov is stating it's a requirement for SMART on FHIR to function and push us to do (3). @msohaib308 - how did you end up resolving this?

vincehartman38 avatar Jun 12 '24 21:06 vincehartman38

I see that they have added CORS now, so this can be closed.

vlad-ignatov avatar Aug 27 '24 14:08 vlad-ignatov