-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird project issue with Cloud Vision API? #706
Comments
Can you use the other services with those environment variables? Or is this only affecting Vision? |
Oh, I think I know what is going on. That Do you have a |
Doesn't seem to be a problem with Datastore, just Vision.
|
OK -- so you're saying that this whole "we don't know who to bill" problem is cropping up here as well? Even if I clearly state the project ID, it still uses the object assigned to the service account? |
If that's the case, we need a much better error than "The Cloud SDK's project isn't activated! Go activate it!" We should tell people they need to generate a service account and use that. |
We clearly state the project id when using gcloud-ruby, but the actual API call doesn't have that info. Other APIs will post to paths like I agree that we should add some documentation that the cli auth credentials won't work for Vision. (Unless we can find a way to add the project id to the API call somehow.) |
Yep - I'm arguing this out on the API side. In the meantime, if we detect using credentials for |
problem solved for me using |
I have used the
But this did not solve my problem
It still hangs on the default project, but I have set the project env too:
|
I suspect #975 may help this issue as well. |
Note to myself when using Natural Language API. Make sure project IS_ACTIVE: gcloud config configurations list If not, set project: gcloud config set project MY_PROJECT Obtain Bearer token: gcloud auth application-default print-access-token No need to use environment variable GOOGLE_APPLICATION_CREDENTIALS |
Had the same issue with Speech API just now.
solved it for me as well. |
Windows batch file which obtains a token.
|
@jgeewax Is this still an issue? |
for simple command line projects use
For complex projects use direct java control
where json creation and API activation are described here Google Vision API Doc Enjoy ! |
I've verified that this is still an issue when using the gcloud SDK when authenticating with a user's personal account. The ruby Vision code detects the project_id from the environment variable, but the credentials that API calls use are recognizing the project that the personal user account authenticated with, which is Even specifically setting the project in the gcloud SDK doesn't affect the project the user's credentials are configured to.
Nor does setting the gcloud SDK authentication using a service account appear to help matters:
IMO the google-cloud-ruby authentication recommendations should remain unchanged. Users should configure the The google-cloud-ruby code does not alter the credentials in any way, so I don't see how google-cloud-ruby can alter this behavior. |
I am getting this Issue anyone get it solved? |
This was solved by setting a default header in all API calls, but the Vision client has changed recently and this was one of the things that was removed. To do this now you need to specify the header values in the call options: require "google/cloud/vision"
image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new
image = {
source: {
gcs_image_uri: "gs://gapic-toolkit/President_Barack_Obama.jpg"
}
}
features = [{ type: :FACE_DETECTION }]
requests = [{ image: image, features: features }]
options = Google::Gax::CallOptions.new(
kwargs: {
"google-cloud-resource-prefix" => "projects/my-project-id"
}
)
response = image_annotator_client.batch_annotate_images(
requests,
options: options
) |
For some reason it looks like Gcloud.vision is detecting my project as
google.com:cloudsdktool
rather than the one set in my environment (jjg-cloud-research
).Any chance this is a bug somewhere?
The text was updated successfully, but these errors were encountered: