Question: From Node, I am attempting to use Google Cloud Vision API to analyze an image stored in Google Storage. I have successfully base64 encoded an image and uploaded it but would like to speed up the process by executing against files I have in Google Storage. My Request is so,

{ "requests":[ { "image":{ "source": { "gcsImageUri" : "gs://mybucket/10001.jpg" } }, "features":[ { "type":"LABEL\_DETECTION", "maxResults":10 } ] } ] }

but I receive this error from my call,

{ "responses": [ { "error": { "code": 7, "message": "image-annotator::User lacks permission.: ACCESS\_DENIED: Anonymous callers do not have storage.objects.get access to object mybucket/10001.jpg." } } ] }

I am not using any google SDK or node\_modules for this request, just a Browser API Key and the http module. Is there some permissions I have to set within Cloud Storage to allow Vision API access to the objects in the bucket? If so what would that be, I am new to Google Cloud Platform but have extensive experience with AWS IAM roles.

Thanks,
VIPER

Answer: 
You are probably invoking the Cloud Vision API anonymously with a GCS image that is not publicly readable. You are likely providing an API key, but API keys do not authenticate request. You can fix this problem in one of two ways:

1. Make an authenticated request to the Cloud Vision API, authenticating as a particular user that has authorization to read the GCS file, or
2. Set the GCS file to allow anonymous read access. You can do this from the console by checking the "publicly readable" checkbox by the object or by using the command-line client like this: `gsutil acl ch -g AllUsers:R gs://mybucket/10001.jpg`.
Actually there are two ways.First way is 
1)Open the bucket of your google cloud vision and there will be a option called "share publicly" and mark it yes for the document you would like to test.Then run the code and you will get the required result