2025-11-12 10:00:00+00:00

The Problem: [storage.objects.get] Permission Errors

When working with Google Cloud Document AI Workbench, one of the most frustrating errors you can encounter happens during the document import phase. You configure your dataset, point it to a Google Cloud Storage (GCS) bucket containing your training PDFs, click import, and get hit with a permission rejection:

{
  "status": {
    "code": 7,
    "message": "Does not have permissions [storage.objects.get] in the bucket"
  }
}

Naturally, your first instinct is to find the Document AI service account and grant it the Storage Object Viewer (or Admin) role. The default Document AI service account typically looks like this:

service-{PROJECT_NUMBER}@gcp-sa-prod-dai-core.iam.gserviceaccount.com

You run gsutil iam ch or use the GCP Console IAM page, grant the permissions, wait for propagation, and try again. Yet, the error persists. Why?


The Root Cause: Project Viewer Context

The root cause is that Document AI Workbench does not authenticate as the service account directly when importing documents via the Cloud Console interface. Instead, it operates under the project's default viewer role context: projectViewer:{YOUR_PROJECT_ID}.

Because the Workbench runs in this context, granting roles to the core Document AI service account does not solve the import authorization checks on the bucket.


The Solution

To resolve this, you must grant the Storage Legacy Object Reader role to the project viewer principal at the project level, rather than the bucket level.

Via gcloud CLI:

gcloud projects add-iam-policy-binding {YOUR_PROJECT_ID} \
  --member="projectViewer:{YOUR_PROJECT_ID}" \
  --role="roles/storage.legacyObjectReader"

Via Google Cloud Console UI:


Key Takeaway

Cloud service integrations often inherit credentials from project-level roles rather than their specific service accounts. Understanding which principal actually performs the actions is key to resolving deceptively simple permission blocks.


About the Author — Hire Freelance Programmer Aldian Fazrihady

Aldian Fazrihady is a Top-Rated Senior Freelance Programmer, Freelance Full Stack Developer, and AI Application Engineer with 15+ years of production software engineering experience and Google Cloud Professional Cloud Architect & Data Engineer certifications. He specializes in building custom LLM & autonomous AI agents, RAG pipelines, Next.js/React PWAs, Python (Django/FastAPI), Go microservices, and serverless cloud infrastructure on Google Cloud Run and AWS.

Hire Aldian Fazrihady on Upwork | Book 1-Day Programming Service ($100 USD via Polar) | View Live AI Portfolio | Portfolio Directory | Send a Direct Message

Related Engineering Articles

Freelance Programmer Specializations & Category Hubs