PermissionDenied: 403 Permission denied on resource project XXXXXXX

26.4k views Asked by At

I am trying to process documents using Google's document AI. But there are some issues, which I am facing. I have created a service account, given all the necessary access, but I am still not able to process documents. Below are the access that my service account have:

  • Document AI Administrator
  • Document AI API User
  • Document AI Editor
  • Storage Admin

Below are the errors which I am getting in my Jupyter Notebook. I am using code from Google's documentation to process documents.

`_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.PERMISSION_DENIED
    details = "Permission denied on resource project XXXXXXXX."
    debug_error_string = "UNKNOWN:Error received from peer ipv6:XXXXXXX {created_time:"2023-11-02T01:26:08.259379+05:30", grpc_status:7, grpc_message:"Permission denied on resource project XXXXXXXX."}"
>

The above exception was the direct cause of the following exception:`

`PermissionDenied: 403 Permission denied on resource project XXXXXXXX. [links {
    description: "Google developer console API key"
    url: "https://console.developers.google.com/project/XXXXXXX/apiui/credential"
},
reason: "CONSUMER_INVALID"
domain: "googleapis.com"
metadata {
    key: "service"
    value: "documentai.googleapis.com"
}
metadata {
    key: "consumer"
    value: "projects/XXXXXXXX"
}`
1

There are 1 answers

0
Holt Skinner On

Download the service account key and use the key in your environment.

I recommend following the steps listed on Quickstart: Set up the Document AI API starting with the environment authentication steps.

If you're using Colab, you can authenticate based on your user account by running this code:

from google.colab import auth
auth.authenticate_user()