Unable to fix BadRequest error

Bram 10 Reputation points
2024-02-26T15:49:46.9966667+00:00

Dear reader,   We have been trying to set up a Power Automate flow to use our trained AI model which we have built in Azure Document Intelligence Studio (so not in Power Automate AI Hub using AI Builder). This means that the AI Model is running within our Azure cloud. We use the connector called 'Form Recognizer' and are connected through an endpoint and an API key (which is retrieved from our Cloud environment). The status of the connector is 'Connected'.   The error in the flow, which is the reason for this post, is the following: _mpa_0-1708948308903.png   The error notification indicates that the file is either corrupted or the format is not supported. The file input is a PDF file, which is not corrupted at all. Trust me, we have tested this in all possible ways. We have checked the microsoft documentation and PDF files are a supported format for the Form Recognizer actions.    Description of the flow: The flow triggers when a new e-mail is received in a folder in a mailbox. Then, the attachment is placed on a SharePoint location in the 'Create file' step. Next, the file properties are retrieved to get the URL. The URL functions as the input to the last step, which is 'Analyze Document for Prebuilt or Custom models'. However, this last step generates an error. We have been trying to figure out what is causing the error and how to fix it, but still no succes.    Some extra information: the file is succesfully created on the sharepoint location. Also, the properties are succesfully retrieved from this file.    The Form Recognizer step is configured as follows: _mpa_1-1708949315986.png   Side information: The complete https URL to the file is 247 characters, which I assume is within limits of the parameters.   We have tried for 6 hours to fix this but so far no luck. We have tried rebuilding the flow and all its connections, but this does not seem to matter. Please note that my Power Automate is running on a trial license and there are no RPA/AI credits assigned to the environment. So far, I have not found this to be a problem anywhere online.    Whenever I run the flow, and then copy the inputURL of the Form Recognizer action (the last step) and paste it into a new tab in my browser, I am directed to the pdf file on the sharepoint. To me, this means that the URL is correct. But the flow keeps throwing the error 'Bad Request'. We are totally lost for solutions.    My request: Can someone please try and help us fix our flow? Or please give any advice on how to try to fix it. Any suggestion is welcome.    I will try to reply as soon as possible and help provide information.    Thanks in advance for your help and response.   Kind regards, Bram

Azure AI Document Intelligence
{count} vote

1 answer

Sort by: Most helpful
  1. Bram 10 Reputation points
    2024-03-19T08:20:09.8333333+00:00

    Hi Vamsi,

    We have found a solution a couple of days ago. Previously, we tried to use the SharePoint URL as an input for the OCR model. Now, instead of using the URL, we use the 'Get File Content' action to retrieve the content of the file, which is used as the input parameter for the 'Analyze Document for Prebuilt or Custom models' action. I have pasted a screenshot of the flow in which you can see all the actions, and will add some more explanation down below.

    User's image

    The input parameter for 'Get file content' is the Id of the report that has been created in the 'Create file' action.

    In the 'Analyze Document' action, we have no input for the parameter 'Document/Image URL' but we have input for the 'Document/Image File Content'. The field we have chosen as input here is the File Content field of the 'Get file content' action. I have pasted a screenshot of the configuration down below. Hopefully this will help you

    Screenshot 2024-03-19 091558

    1 person found this answer helpful.
    0 comments No comments

Your answer

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