Search code examples
google-cloud-platformcloud-document-ai

Permission 'documentai.processors.processOnline' denied on resource (or it may not exist)


I am trying to send a POST request to the Cloud Document AI API using Postman. I have tried sending a POST request with the API key included, along with providing an OAuth access token as the OAuth 2.0 Authorization (generated using gcloud auth application-default print-access-token). However, this error is returned:

{
"error": {
    "code": 403,
    "message": "Permission 'documentai.processors.processOnline' denied on resource '//documentai.googleapis.com/projects/<project id>/locations/us/processors/<processor id>' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "IAM_PERMISSION_DENIED",
            "domain": "documentai.googleapis.com",
            "metadata": {
                "resource": "projects/<project id>/locations/us/processors/<processor id>",
                "permission": "documentai.processors.processOnline"
            }
        }
    ]
}

I think this this a problem with the service account permission. If so, is there any way I can resolve this if I don't have the access to change roles?


Solution

  • Just to give an update to this question. The problem was related to the service account permission. There is no way to resolve this without setting up your service account with the correct permission. Once you have correctly set up your service account, by using the service account key of said account, you should be able to resolve this problem.

    TLDR; Follow the documentation (https://cloud.google.com/document-ai/docs/setup#auth) properly. If you don't have access to the Google Account (like I did), try to get access to it. If not, I don't think there is another way around it.