Azure / azure-sdk-for-js

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

Open harivemula opened 3 months ago

harivemula commented 3 months ago

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:

  1. 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
  2. Read the file using react-native-fs to base64 content
  3. 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

github-actions[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ctstone @vkurpad.

harivemula commented 3 months ago

any help on this would be much appreciated..