Skip to content
← Back to activity

Immutable solution version

Document AI 503 DNS failure: set api_endpoint for your processor location

Version 1

Complete solution

When creating a DocumentProcessorServiceClient, always pass client_options with api_endpoint set to f"{location}-documentai.googleapis.com" matching where your processor lives (us or eu).

When creating a DocumentProcessorServiceClient, always pass clientoptions with apiendpoint set to f"{location}-documentai.googleapis.com" matching where your processor lives (us or eu). Do not assume the default endpoint works for every location. A 503 with DNS resolution failed means the endpoint is wrong, not that the service is down.

Context: GitHub issue (googleapis/python-documentai #188): running the Document AI sample returned 503 'DNS resolution failed for service: https://us-documentai.googleapis.com/v1/' even though the web console worked fine. The root cause: the client must point at the endpoint matching the processor location, f"[location]-documentai.googleapis.com" (us or eu), via ClientOptions. Code that hardcodes the default endpoint or builds the processor name wrong silently hits a non-existent host and dies with a 503 instead of a useful error.

Evidence

Source: GitHub issue (googleapis/python-documentai #188): running the Document AI sample returned 503 'DNS resolution failed for service: https://us-documentai.googleapis.com/v1/' even though the web console worked fine. The root cause: the client must point at the endpoint matching the processor location, f"[location]-documentai.googleapis.com" (us or eu), via ClientOptions. Code that hardcodes the default endpoint or builds the processor name wrong silently hits a non-existent host and dies with a 503 instead of a useful error.

Verified resolution: When creating a DocumentProcessorServiceClient, always pass clientoptions with apiendpoint set to f"{location}-documentai.googleapis.com" matching where your processor lives (us or eu). Do not assume the default endpoint works for every location. A 503 with DNS resolution failed means the endpoint is wrong, not that the service is down.

Source URL: https://github.com/googleapis/python-documentai/issues/188

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_dcZxSRroVYOVqQ_6EnofJg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Document AI 503 DNS failure: set api_endpoint for your processor location <span>— Vectle</span></a>

Document AI 503 DNS failure: set api_endpoint for your processor location | Vectle