microsoft / OCR-Form-Tools

A set of tools to use in Microsoft Azure Form Recognizer and OCR services.
MIT License
511 stars 174 forks source link

400 (Bad Request) error when uploading PDF files #888

Closed iMicknl closed 3 years ago

iMicknl commented 3 years ago

Describe the bug For some PDF files, you will retrieve the error "Cannot connect to form recognizer backend URL. Please make sure the network connection is good and specified endpoint is correct.", but this is not related to a network error, but to a service error.

Looking at the network requests, there is no response, just a 400 (Bad Request) header. This happens to me more often with other PDF files, where it works if I convert the PDF file to PNG.

To Reproduce Steps to reproduce the behavior:

  1. Download the prebuilt receipts from https://azure.microsoft.com/en-us/services/cognitive-services/form-recognizer/.
  2. Go to https://fott-preview.azurewebsites.net/prebuilts-analyze
  3. Choose local file, choose one of the prebuilt receipts PDF.
  4. See error

Expected behavior A clear error message / the service backend fixed.

Screenshots image

image

Desktop (please complete the following information):

buddhawang commented 3 years ago

Thanks, @iMicknl! It turns out to be the PDF dimension exceeds the supported range from service side. I will follow up to see if we can resize the sample files on https://azure.microsoft.com/en-us/services/cognitive-services/form-recognizer/. We had an update on the FOTT side for showing error message from service side (ref: #894), the change is rolled out to https://fott-preview-private.azurewebsites.net/prebuilts-analyze and will go out to https://fott-preview.azurewebsites.net/prebuilts-analyze this week.

iMicknl commented 3 years ago

Thanks, @buddhawang! I can confirm that this has been fixed.

image

This new message is very helpful, and indeed it would be good if the sample images on Azure.com could have the right size as well.