Closed agiokas-dbg closed 4 years ago
@agiokas-dbg could you please give preview.2 a try? There might be some error but in preview.1 the poller doesn't throw errors.
If you are unable to use preview.2, please try the following to see whether any error is logged.
const state = poller.getOperationState();
console.log(state.error);
@jeremymeng hi, thanks for the reply! Should I do this in the callback while it's running or after?
I suspect there's a version miss match happening here. The actual output from the AWS lambda is:
"url": "https://validation-form-recogniser.cognitiveservices.azure.com/formrecognizer/v2.0-preview/custom/models/f0349158-3474-4f58-a798-8ce26891538b/analyze",
I added the lines you suggested, and here's the result:
START RequestId: 0adcdc26-2cb2-488f-a0f0-be8763e483c5 Version: $LATEST
2020-05-29T11:56:18.034Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO ENDPOINT https://validation-form-recogniser.cognitiveservices.azure.com/
2020-05-29T11:56:18.035Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO MODEL_UUID f0349158-3474-4f58-a798-8ce26891538b
2020-05-29T11:56:18.035Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO FILE_PATH italian_best.pdf
2020-05-29T11:56:18.035Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO BUCKET evidence-extractor-bucket
2020-05-29T11:56:18.047Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO TMP_FILE /tmp/6a206df4-e0db-489e-a99f-79e871dbd05e.pdf
2020-05-29T11:56:18.708Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO { ext: 'pdf', mime: 'application/pdf' }
2020-05-29T11:56:19.868Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO status: notStarted
2020-05-29T11:56:19.896Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO status: notStarted
2020-05-29T11:56:24.960Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO status: notStarted
2020-05-29T11:56:30.017Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 INFO TypeError: Cannot read property 'type' of null
at toFieldValue (/var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:1875:29)
at toFieldsFromFieldValue (/var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:1939:32)
at toRecognizedForm (/var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:1988:17)
at /var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:1866:69
at Array.map (<anonymous>)
at toRecognizeFormResultResponse (/var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:1866:58)
at FormRecognizerClient$1.<anonymous> (/var/task/node_modules/@azure/ai-form-recognizer/dist/index.js:2867:24)
at Generator.next (<anonymous>)
at fulfilled (/var/task/node_modules/tslib/tslib.js:110:62)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
2020-05-29T11:56:30.028Z 0adcdc26-2cb2-488f-a0f0-be8763e483c5 ERROR Invoke Error {"errorType":"Error","errorMessage":"Expecting a response!","stack":["Error: Expecting a response!"," at Runtime.exports.azure_query_func [as handler] (/var/task/app.js:72:15)"," at processTicksAndRejections (internal/process/task_queues.js:97:5)"]}
Also, I am now using 1.0.0-preview.2
and I am no longer getting this error.
I suspect it was some internal mechanism?
@agiokas-dbg Glad to hear that preview.2 worked fine for you. I suspect that it's the same issue that was fixed by #8703, although what puzzled me is that your original report seems to indicate that the issue didn't happen in the emulator case. Now I guess only some input documents caused the error?
@jeremymeng The same document is when run locally (SAM) worked, but failed on AWS. I thought it had to do with time-outs, but I suspect it may have to do with Unicode encoding? I honestly don't know because I've done about 16 different form models on Azure and this is the only one with this problem.
Is it possible for you to share the document that was causing problem?
Hi @jeremymeng Yes I can, I've also run into another document that seems to cause the same problem. I'm getting back no response.
But when I try the dockerized UI tool(mcr.microsoft.com/azure-cognitive-services/custom-form/labeltool
) and I use it there it seems to work fine! When I invoke the npm API it seems not to return a response. Let me know if you want the OCR and LABELS jsons.
The file is attached below:
Thanks! I will have a look at this document.
Thanks Jeremy. It's still the case where the UI labeltool works fine, but I'm getting null responses.
@agiokas-dbg I want to ensure that I understand it thoroughly:
finish_early.pdf
. It all worked fine there.beginRecognizeForms()
on finish_early.pdf
a. Locally in AWS SAM environment it works fine too
b. in AWS it failed with a null response1.0.0-preview.1
1.0.0-preview.2
Please let me know if any of the above isn't right.
I tested the document but didn't see any thing unusual. Of course I don't have your custom model or training data to test the custom form recognition. In the case if preview.2 didn't work for you then I might need those to investigate further.
Thank you!
Hi @jeremymeng I think you can close this issue. I tried it again today, first with SAM locally, then invoking the AWS step function code and it seems to work now. I suspect I had the older version active in one of my apps/lambdas. The newer one seems to have fixed it!
Sounds good. Thanks for testing it.
Describe the bug I am using AWS SAM, the UI and Step functions. The AWS SAM (local execution) works absolutely fine! However when I move on the lambda to AWS it produces an error which is related to the query to azure. I've turned on
DEBUG
to try and figure out why I get no response. Similar lambdas I've written work absolutely fine, this is the only one that doesn't!The actual debug output is:
Expected behavior
When running from SAM, I get:
Additional context
What I see happening on the AWS lambda is that the response is
null
. The source code is:Any help is greatly appreciated!