Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Document AI processor location error: Invalid location: 'eu' must match the server deployment 'us'

I need help regarding a document AI processor location/region issue we are facing. Currently it return an error if we use a processor with EU location but works fine with US location. Although, in GCP it says processor are available for both EU and US regions.

I am using Laravel and `google/cloud-document-ai` package to use it.

Here is the error return by Document AI  API call while setting up request to process Pdf document:

 

{
    "message": "Request contains an invalid argument.",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "type.googleapis.com\/google.rpc.BadRequest",
            "fieldViolations": [
                {
                    "field": "name",
                    "description": "Invalid location: 'eu' must match the server deployment 'us'"
                }
            ]
        }
    ]
}

 

Here are my processor details:
image (52).pngimage.png

Solved Solved
0 1 47
1 ACCEPTED SOLUTION

Hi surinderfnl,

Welcome to Google Cloud Community!

When utilizing the Google Document AI API, an INVALID_ARGUMENT error indicates a specific configuration mismatch, not an issue with authentication or permissions. This error occurs when the regional location specified in the processor's resource name does not match the regional API endpoint the client is configured to call.

Document AI is a regionalized service, meaning processors and their corresponding API endpoints are isolated by geographic location (e.g., us or eu). The API client library must be explicitly instructed to target the correct regional endpoint. The INVALID_ARGUMENT error arises from one of two inconsistencies:

  • Incorrect Endpoint: The API client defaults to the us-documentai.googleapis.com endpoint, but the request contains a processor name specifying the eu location (e.g., projects/.../locations/eu/processors/...). The US service receives the request and correctly rejects it as it does not manage eu resources.
  • Incorrect Resource Name: The API client has been correctly configured to target the eu-documentai.googleapis.com endpoint, but the processor resource name within the request payload still specifies the US location.

The fundamental principle is that the server you are calling must be the one that actually hosts the resource you are requesting.

Note that you must ensure perfect alignment between the client's API endpoint configuration and the location defined in the processor's resource name. Both must reference the EU region.

As a workaround, you may verify the following points in your codebase:

  • Confirm the Location Variable: Ensure the variable holding the location string is correctly and consistently set to 'eu'.
  • Validate the API Endpoint: Confirm that the apiEndpoint passed during client initialization resolves to eu-documentai.googleapis.com.
  • Check the Processor Name Construction: Verify that the $client->processorName() helper method is called with the same 'eu' location variable, ensuring the final resource string is accurate.
  • Verify the Processor ID: Double-check in the Google Cloud Console that the Processor ID itself is correct for the resource deployed in the EU region.

By aligning these configuration values, you instruct the client library to send the request to the correct regional service that hosts your processor.

Also, feel free to refer to this case that you may find useful.

Was this helpful? If so, please accept this answer as โ€œSolutionโ€. If you need additional assistance, reply here within 2 business days and Iโ€™ll be happy to help.

View solution in original post

1 REPLY 1

Hi surinderfnl,

Welcome to Google Cloud Community!

When utilizing the Google Document AI API, an INVALID_ARGUMENT error indicates a specific configuration mismatch, not an issue with authentication or permissions. This error occurs when the regional location specified in the processor's resource name does not match the regional API endpoint the client is configured to call.

Document AI is a regionalized service, meaning processors and their corresponding API endpoints are isolated by geographic location (e.g., us or eu). The API client library must be explicitly instructed to target the correct regional endpoint. The INVALID_ARGUMENT error arises from one of two inconsistencies:

  • Incorrect Endpoint: The API client defaults to the us-documentai.googleapis.com endpoint, but the request contains a processor name specifying the eu location (e.g., projects/.../locations/eu/processors/...). The US service receives the request and correctly rejects it as it does not manage eu resources.
  • Incorrect Resource Name: The API client has been correctly configured to target the eu-documentai.googleapis.com endpoint, but the processor resource name within the request payload still specifies the US location.

The fundamental principle is that the server you are calling must be the one that actually hosts the resource you are requesting.

Note that you must ensure perfect alignment between the client's API endpoint configuration and the location defined in the processor's resource name. Both must reference the EU region.

As a workaround, you may verify the following points in your codebase:

  • Confirm the Location Variable: Ensure the variable holding the location string is correctly and consistently set to 'eu'.
  • Validate the API Endpoint: Confirm that the apiEndpoint passed during client initialization resolves to eu-documentai.googleapis.com.
  • Check the Processor Name Construction: Verify that the $client->processorName() helper method is called with the same 'eu' location variable, ensuring the final resource string is accurate.
  • Verify the Processor ID: Double-check in the Google Cloud Console that the Processor ID itself is correct for the resource deployed in the EU region.

By aligning these configuration values, you instruct the client library to send the request to the correct regional service that hosts your processor.

Also, feel free to refer to this case that you may find useful.

Was this helpful? If so, please accept this answer as โ€œSolutionโ€. If you need additional assistance, reply here within 2 business days and Iโ€™ll be happy to help.