Error while using Azure Invoice Disconnected Container

Aditya Ghuwalewala 0 Reputation points
2024-10-01T14:49:41.7533333+00:00

I have setup both azure and layout containers. When trying to call the syncAnalyze api in azure invoice as follows:

curl -v -X POST "http://:8080/formrecognizer/documentModels/prebuilt-invoice:syncAnalyze?api-version=2023-07-31" -H 'accept: /' -H 'Content-Type: application/octet-stream' --data-binary '@/tmp/amazon.jpg'

{"status":"failed","createdDateTime":"2024-10-01T14:29:19Z","lastUpdatedDateTime":"2024-10-01T14:29:19Z","error":{"code":"InternalServerError","message":"An unexpected error occurred.","details":[{"code":"UnexpectedResponseContentTypeFromUpstream","message":"Received unexpected content type from read/layout host service.","target":"1"}]}}

There are no logs in Azure layout container

Logs from Invoice container as follows

VdiErrorCode:UnexpectedResponseContentTypeFromUpstream(132); HttpStatusCode:500; MethodName:ValidBinaryResponse; SourceFilePath:/__w/1/s/src/OnPremises.Common/Handler/FrBaseHandler.cs; SourceLineNumber: 84; DetailMessage:Unexpected response content type: application/json; StackTrace: at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.FrBaseHandler.ValidBinaryResponse(HttpResponseMessage response)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.PostUpstreamInternalRequest(String modelId, Byte[] stream, ServiceMessage message)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.HandleMessageAsync(ServiceMessage message) SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' errorCode='UnexpectedResponseContentTypeFromUpstream'
fail: formrecognizerinvoice[0]
 Failed to process a queue message SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' queueName='onprem-upstream-handler-frinvoice20230731' workItemId='b870a9a0-ab43-4adb-822d-0c2306284101' dequeueCount='1' performanceMetric='OneMessageStayInQueueTime' durationInMs='152' concurrentRequests='2' errorCode='ProcessMessageFailed'
fail: formrecognizerinvoice[0]
 VdiErrorCode:UnexpectedResponseContentTypeFromUpstream(132); HttpStatusCode:500; MethodName:ValidBinaryResponse; SourceFilePath:/__w/1/s/src/OnPremises.Common/Handler/FrBaseHandler.cs; SourceLineNumber: 84; DetailMessage:Unexpected response content type: application/json; StackTrace: at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.FrBaseHandler.ValidBinaryResponse(HttpResponseMessage response)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.PostUpstreamInternalRequest(String modelId, Byte[] stream, ServiceMessage message)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.HandleMessageAsync(ServiceMessage message) SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' errorCode='UnexpectedResponseContentTypeFromUpstream'
fail: formrecognizerinvoice[0]
 Failed to process a queue message SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' queueName='onprem-upstream-handler-frinvoice20230731' workItemId='b870a9a0-ab43-4adb-822d-0c2306284101' dequeueCount='2' performanceMetric='OneMessageStayInQueueTime' durationInMs='136' concurrentRequests='2' errorCode='ProcessMessageFailed'
fail: formrecognizerinvoice[0]
 VdiErrorCode:UnexpectedResponseContentTypeFromUpstream(132); HttpStatusCode:500; MethodName:ValidBinaryResponse; SourceFilePath:/__w/1/s/src/OnPremises.Common/Handler/FrBaseHandler.cs; SourceLineNumber: 84; DetailMessage:Unexpected response content type: application/json; StackTrace: at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.FrBaseHandler.ValidBinaryResponse(HttpResponseMessage response)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.PostUpstreamInternalRequest(String modelId, Byte[] stream, ServiceMessage message)
 at Microsoft.CloudAI.Containers.VDI.OnPremises.Common.Handler.Fr30GaUpstreamHandler.HandleMessageAsync(ServiceMessage message) SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' errorCode='UnexpectedResponseContentTypeFromUpstream'
fail: formrecognizerinvoice[0]
 Failed to process a queue message SubscriptionId='' RequestId='78762046-6021-41bc-87da-55e37e1bc4a9' Timestamp='' buildVersion='1.2.978.0-20240808.1-d7499e4c2b8a2802977c570508a77efb62dae609' hostId='vs-azure-invoice-785b4b55ff-w26gk' serviceName='formrecognizerinvoice' namespace='vdi' Namesapce='vdi' fileSizeInBytes='200188' processedPageIndex='0' toSecondaryQueue='False' isSubBatchRequest='False' totalPageCount='1' fileType='Jpeg' apiName='invoice-2023-07-31' ocrModelName='2023-07-31' scenario='fr_async_layout' resultNameEnum='UpstreamFRResult' ocrResolution='Standard' queueName='onprem-upstream-handler-frinvoice20230731' workItemId='b870a9a0-ab43-4adb-822d-0c2306284101' dequeueCount='3' performanceMetric='OneMessageStayInQueueTime' durationInMs='135' concurrentRequests='2' errorCode='ProcessMessageFail
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,707 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sina Salam 11,916 Reputation points
    2024-10-01T17:13:12.99+00:00

    Hello Aditya Ghuwalewala,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having issue with the Azure Form Recognizer service while attempting to call the syncAnalyze API for invoice processing.

    1. Kindly check you're using the correct URL format, azure endpoint and that the model ID is correct.
            curl -v -X POST "http://<your-azure-endpoint>:8080/formrecognizer/documentModels/prebuilt-invoice:syncAnalyze?api-version=2023-07-31" -H 'accept: application/json' -H 'Content-Type: application/octet-stream' --data-binary '@/tmp/amazon.jpg'
      
    2. The image you're uploading (amazon.jpg) need to check if it is a valid JPEG file and meets the requirements of the API. It might have been corrupted or unsupported formats.
    3. If everything is correct as above and you still have the same error, it might be a transient error, retry later.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

  2. Aditya Ghuwalewala 0 Reputation points
    2024-10-03T16:38:53.7533333+00:00

    Thanks!

    I was able to successfully get the response now. The issue was that i was using the same license for both the invoice and layout containers. So once i generated a fresh license for the layout container and started it with the fresh license, then it began to work.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.