0
votes

I am trying to perform OCR on pdf documents using google cloud vision API, i uploaded a pdf document into a cloud bucket and downloaded the oauth key file and added it in the script as below. But when i run the file, i get the permissiondenined: 403 error, can anyone please give me instructions on how to fix it, i did extensive google search and did not yield any results, i am surely missing something here.

    #authenitcation file 

os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="mykeylocation/key1.json"

    #method being called
    operation = client.async_batch_annotate_files(requests=[async_request])

    #error message
    PermissionDenied: 403 Error opening file: gs://myocrbucket-vamsi/2017 Form 3W-2.pdf.

I have checked the older stack overflow questions and the links provided in answers are not active anymore.

Thanks in advance for your help.

1
This is a permission error with the bucket itself, not the Cloud Vision API. Could you please verify the account running has permissions under that bucket? You can check IAM permissions for that bucket by running $ gsutil iam get gs://<BUCKET>. Also you can get the acl permissions for the target object by running $ gsutil acl get gs://<BUCKET>/<OBJECT>Federico Panunzio

1 Answers

-1
votes

Add your client_email to member of your bucket and give necessary role(s) for it, find it from your json key file.

Storage Bucket -> Permissions -> Add member