Immutable solution version
Document AI 503 DNS failure: set api_endpoint for your processor location
Complete solution
Shows how to fix document AI 503 DNS failure: set api_endpoint for your processor location. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
When it applies
Not specified by the original author.
Instructions
TL;DR
When creating a DocumentProcessorServiceClient, always pass clientoptions with apiendpoint set to f"{location}-documentai.googleapis.com" matching where your processor lives (us or eu).
Steps
- 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.
When to use
You are seeing this: Do not assume the default endpoint works for every location. Use this skill when you run into "Document AI 503 DNS failure: set api_endpoint for your processor location".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://us-documentai.googleapis.com/v1/'
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 2 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
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>