404 - Resource not found when calling Form Recognizer API

Kalidoss, Ishwarya 0 Reputation points
2023-05-23T05:27:37.63+00:00

Hi Experts,

I'm calling Azure Form recognizer API from a python script. It's working from my local machine but not working from the virtual machine. I've tried testing from postman. Its working in postman but when calling from Python its throwing 404 error. It's very strange. Its failing in the below place. Kindly suggest

with open(path_to_sample_documents, "rb") as f:
    poller = document_analysis_client.begin_analyze_document(
    raise error
azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
2,122 questions
{count} votes

4 answers

Sort by: Most helpful
  1. VasimTamboli 5,215 Reputation points
    2023-05-23T13:57:35.0933333+00:00

    The 404 error "Resource not found" typically indicates that the endpoint or resource you are trying to access was not found. Here are a few suggestions to troubleshoot the issue:

    Verify the endpoint URL: Double-check that the endpoint URL you are using in your Python script matches the correct endpoint for the Azure Form Recognizer API. Ensure that there are no typos or missing segments in the URL.

    Check the API key or authentication credentials: Confirm that you are using the correct API key or authentication credentials to authenticate your requests. The API key should be valid and associated with the Azure Form Recognizer service.

    Validate the resource existence: Ensure that the resource (such as the Form Recognizer service) is provisioned and accessible from the virtual machine. Check the Azure portal to verify the status of the resource and make sure it is running and accessible.

    Verify network connectivity: Check if the virtual machine has outbound network connectivity to the Azure Form Recognizer service. Ensure that there are no network restrictions or firewalls blocking the outbound requests from the virtual machine.

    Debugging headers and logs: Enable verbose logging or capture the request and response headers to get more details about the request being sent from the Python script. This can help identify any potential issues or discrepancies in the requests being made.

    1 person found this answer helpful.

  2. GUDIPALLY RAJASHEKAR REDDY 0 Reputation points
    2024-07-12T16:06:56.58+00:00

    Hi Team,

    I am also facing same issue. Verified all the details from azure portal. still getting same issue while using the AzureAIDocumentIntelligenceLoader. Tried all the options provided. added key api_version="2023-07-31" still getting error.

    Refer below error:

    File "/usr/local/lib/python3.11/site-packages/azure/core/exceptions.py", line 161, in map_error

    raise error
    

    azure.core.exceptions.ResourceNotFoundError: (404) Resource not found

    Code: 404

    Message: Resource not found

    0 comments No comments

  3. Endre Moen 0 Reputation points
    2024-11-05T12:10:45.5466667+00:00

    I have same error. I have a service which is AIServices which is a cognitive service and it works. But the new resource which is FormRecognizer does not work. I get Code: 404

    Message: Resource not found

    There should be a link in the resource page that allows you to test the service. I dont know of any option except coding to check the service.

    0 comments No comments

  4. Julien Ollivier 0 Reputation points
    2024-12-09T12:32:19.6866667+00:00

    I encountered this issue as well. The problem was that I was using the latest Python SDK, which attempted to access the REST API version 2024-07-31-preview. This version wasn't compatible with the location I selected during the deployment of the Document Intelligence instance on Azure.

    Hope it help, I passed too much time understanding this was my issue

    0 comments No comments

Your answer

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