This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
1.98k
stars
1.15k
forks
source link
ai-form-recognizer - beginAnalyzeDocument wrongly detecting base64 body as url and throws error RestError: Invalid argument. #28915
Describe the bug
I am using @azure/ai-form-recognizer to send base64 content of an image to beginAnalyzeDocument for prebuilt invoice/receipt models, but the SDK throws error "RestError: Invalid argument.".
All the samples show using beginAnalyzeDocumentFromUrl with http url, and no sample with base64 type body.
To Reproduce
Steps to reproduce the behavior:
Use the sample provided here https://github.com/Azure/azure-sdk-for-js/blob/%40azure/ai-form-recognizer_5.0.0/sdk/formrecognizer/ai-form-recognizer/samples/v5/javascript/analyzeReceiptByModelId.js
Read the file using react-native-fs to base64 content
modify the sample to invoke beginAnalyzeDocument with base64 body.
Expected behavior
Error was not clear and when i put logs in the sdk in npm modules, found out that the base64 body type was detected as URL.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
react-native 0.73.5
Describe the bug I am using @azure/ai-form-recognizer to send base64 content of an image to beginAnalyzeDocument for prebuilt invoice/receipt models, but the SDK throws error "RestError: Invalid argument.". All the samples show using
beginAnalyzeDocumentFromUrl
with http url, and no sample with base64 type body.To Reproduce Steps to reproduce the behavior:
https://github.com/Azure/azure-sdk-for-js/blob/%40azure/ai-form-recognizer_5.0.0/sdk/formrecognizer/ai-form-recognizer/samples/v5/javascript/analyzeReceiptByModelId.js
beginAnalyzeDocument
with base64 body.Expected behavior Error was not clear and when i put logs in the sdk in npm modules, found out that the base64 body type was detected as URL.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here. react-native 0.73.5