Azure API for FHIR 500 internal server error

Tom Kay 1 Reputation point
2021-09-14T13:26:14.877+00:00

Hi All,

I've followed https://github.com/microsoft/OpenHack-FHIR/blob/main/Challenge02.1-HL7IngestandConvertUsingBash/ReadMe.md
to setup a HL7 -> FHIR ingestion and conversion pipeline.

However, during the final stage of conversion. The FHIR server I have setup returns a 500 error upon receiving a HL7 Message.

Screenshot attached below. I was wondering if someone might be able to tell me how to track the source of the error down, as I can't
see a Terminal option on the Azure Portal.. or perhaps what might be causing the issue?

Many Thanks

Tom

131966-screen-shot-2021-09-14-at-42108-pm.png

Azure Health Data Services
Azure Health Data Services
An Azure offering that provides a suite of purpose-built technologies for protected health information in the cloud.
150 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Tom Kay 1 Reputation point
    2021-09-14T15:19:33.763+00:00

    I managed to find the event logs; I can see now that my FHIR Server is returning a 400 error while authenticating. I suspect there must have been a misconfiguration somewhere in the AD settings..

    2021-09-14T15:15:17 Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).
    2021-09-14T15:15:25.799 [Information] Executing 'Import' (Reason='This function was programmatically called via the host APIs.', Id=REDACTED)
    2021-09-14T15:15:25.799 [Information] FHIR Proxy - Import Function Invoked
    2021-09-14T15:15:25.799 [Information] Obtaining new OAUTH2 Bearer Token for access to FHIR Server
    2021-09-14T15:15:26.189 [Error] Executed 'Import' (Failed, Id=REDACTED, Duration=378ms)The remote server returned an error: (400) Bad Request.

    0 comments No comments

  2. Oury Ba-MSFT 17,146 Reputation points Microsoft Employee
    2021-09-14T19:57:58.837+00:00

    Hi @Tom Kay Thank you for posting your question on Microsoft Q&A.

    A parameter(s) might have been passed incorrectly when deploying the convertor, causing FHIR Server Proxy API Connection to not get created correctly.
    Couple places to check:

    • In Logic App, try creating new connection to FHIR and re-run
    • Double-check configs values in Function App

    If these doesn’t help, try re-deploying to double-check if parameters were passed correctly. If you are using 2 tenant deployment, make sure the values are from the right tenant.

    Please let us know if this is helpful.

    Regards,
    Oury

    0 comments No comments

  3. Tom Kay 1 Reputation point
    2021-09-15T08:19:31.47+00:00

    Thank you for your response @Oury Ba-MSFT , I'm still working on debugging the issue. I'm not sure if this related but I noticed in Task 02 of https://github.com/microsoft/OpenHack-FHIR/blob/main/Challenge02.1-HL7IngestandConvertUsingBash/ReadMe.md when executing ./deployhl72fhir.bash

    I receive the error below. Is this something I should be concerned about?

    Deploying FHIREventProcessor Function App from repo to host [REDACTED.azurewebsites.net]...  
    Setting SCM_DO_BUILD_DURING_DEPLOYMENT to false  
    Waiting SCM site to be updated with the latest app settings  
    CLIInternalError: The command failed with an unexpected error. Here is the traceback:  
    HTTPSConnectionPool(host='REDACTED.scm.azurewebsites.net', port=443): Read timed out. (read timeout=3)  
    Traceback (most recent call last):  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 387, in _make_request  
        six.raise_from(e, None)  
      File "<string>", line 2, in raise_from  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 383, in _make_request  
        httplib_response = conn.getresponse()  
      File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1347, in getresponse  
        response.begin()  
      File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 307, in begin  
        version, status, reason = self._read_status()  
      File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 268, in _read_status  
        line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")  
      File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 669, in readinto  
        return self._sock.recv_into(b)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 317, in recv_into  
        raise timeout('The read operation timed out')  
    socket.timeout: The read operation timed out  
      
    During handling of the above exception, another exception occurred:  
      
    Traceback (most recent call last):  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/adapters.py", line 439, in send  
        resp = conn.urlopen(  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 640, in urlopen  
        retries = retries.increment(method, url, error=e, _pool=self,  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/util/retry.py", line 368, in increment  
        raise six.reraise(type(error), error, _stacktrace)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/packages/six.py", line 686, in reraise  
        raise value  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 600, in urlopen  
        httplib_response = self._make_request(conn, method, url,  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 389, in _make_request  
        self._raise_timeout(err=e, url=url, timeout_value=read_timeout)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/urllib3/connectionpool.py", line 307, in _raise_timeout  
        raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)  
    urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='fhirevt29531.scm.azurewebsites.net', port=443): Read timed out. (read timeout=3)  
      
    During handling of the above exception, another exception occurred:  
      
    Traceback (most recent call last):  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/knack/cli.py", line 215, in invoke  
        cmd_result = self.invocation.execute(args)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute  
        raise ex  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially  
        results.append(self._run_job(expanded_arg, cmd_copy))  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 711, in _run_job  
        six.reraise(*sys.exc_info())  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/six.py", line 703, in reraise  
        raise value  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job  
        result = cmd_copy(params)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__  
        return self.handler(*args, **kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 784, in default_command_handler  
        return op(**command_args)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 380, in enable_zip_deploy_functionapp  
        remove_remote_build_app_settings(cmd, resource_group_name, name, slot)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 510, in remove_remote_build_app_settings  
        scm_is_up_to_date = validate_app_settings_in_scm(  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 966, in validate_app_settings_in_scm  
        scm_settings = _get_app_settings_from_scm(cmd, resource_group_name, name, slot)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/utils.py", line 64, in call  
        raise exception  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/utils.py", line 60, in call  
        return func(*args, **kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 995, in _get_app_settings_from_scm  
        response = requests.get(settings_url, headers=headers, auth=(username, password), timeout=3)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/api.py", line 75, in get  
        return request('get', url, params=params, **kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/api.py", line 60, in request  
        return session.request(method=method, url=url, **kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/sessions.py", line 533, in request  
        resp = self.send(prep, **send_kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/sessions.py", line 646, in send  
        r = adapter.send(request, **kwargs)  
      File "/usr/local/Cellar/azure-cli/2.13.0/libexec/lib/python3.8/site-packages/requests/adapters.py", line 529, in send  
        raise ReadTimeout(e, request=request)  
    requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='REDACTED.scm.azurewebsites.net', port=443): Read timed out. (read timeout=3)  
    To open an issue, please run: 'az feedback'  
    Command failed. Retry Attempt 2/5 in 15 seconds:  
    Getting scm site credentials for zip deployment  
    Starting zip deployment. This operation can take a while to complete ...  
    Deployment endpoint responded with status code 202  
      
    
    0 comments No comments

  4. Tom Kay 1 Reputation point
    2021-09-15T11:17:16.357+00:00

    I can now see the events get through successfully on my Event Function App deployed in Task 02 of https://github.com/microsoft/OpenHack-FHIR/blob/main/Challenge02.1-HL7IngestandConvertUsingBash/ReadMe.md

    Output from Event Function App Log:

    Connected!
    2021-09-15T11:11:17 Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).
    2021-09-15T11:11:28.208 [Information] Executing 'Import' (Reason='This function was programmatically called via the host APIs.', Id=c3605fb0-07dc-47a4-9a8b-e88876774d26)
    2021-09-15T11:11:28.304 [Information] FHIR Proxy - Import Function Invoked
    2021-09-15T11:11:28.310 [Information] Obtaining new OAUTH2 Bearer Token for access to FHIR Server
    2021-09-15T11:11:28.553 [Information] Instanciating FHIR Client Proxy
    2021-09-15T11:11:28.592 [Information] TransformBundleProcess: looks like a valid transaction bundle
    2021-09-15T11:11:28.592 [Information] TransformBundleProcess: Phase 1 searching for existing entries on FHIR Server...
    2021-09-15T11:11:28.593 [Information] TransformBundleProcess: Phase 2 Localizing 4 resource entries...
    2021-09-15T11:11:28.857 [Information] Executed 'Import' (Succeeded, Id=c3605fb0-07dc-47a4-9a8b-e88876774d26, Duration=928ms)
    2021-09-15T11:12:15.953 [Information] Host Status: {"id": "fhirevt19908","state": "Running","version": "3.1.3.0","versionDetails": "3.1.3 Commit hash: 9a07f8b0506c207ce547e275ee4e735785639ffa","platformVersion": "95.0.7.562","instanceId": "d711311de7fe4827ff36f12724a8278a1b865fb7a038cd49889219877a962037","computerName": "dw1sdwk00006Z","processUptime": 409464}
    2021-09-15T11:12:15.959 [Information] Host Status: {"id": "fhirevt19908","state": "Running","version": "3.1.3.0","versionDetails": "3.1.3 Commit hash: 9a07f8b0506c207ce547e275ee4e735785639ffa","platformVersion": "95.0.7.562","instanceId": "d711311de7fe4827ff36f12724a8278a1b865fb7a038cd49889219877a962037","computerName": "dw1sdwk00006Z","processUptime": 409470}

    However the Logic App run now fails with a 401 Authentication failed.

    {
    "resourceType": "OperationOutcome",
    "id": "xxx",
    "issue": [
    {
    "severity": "error",
    "code": "login",
    "diagnostics": "Authentication failed."
    }
    ]
    }

    I've also followed the instructions to configure Azure RBAC https://learn.microsoft.com/en-us/azure/healthcare-apis/azure-api-for-fhir/configure-azure-rbac which I found at https://github.com/MicrosoftDocs/azure-docs/issues/55734 to no avail.

    0 comments No comments

  5. Oury Ba-MSFT 17,146 Reputation points Microsoft Employee
    2021-09-21T21:32:33.743+00:00

    Hi @Tom Kay I am suggesting to check in challenge 1 following every steps as looks like something was missed.

    Regards,
    Oury

    0 comments No comments