Skip to content
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

no access to Google Cloud Service #74

Closed
mrmvergeer opened this issue Jul 19, 2020 · 2 comments
Closed

no access to Google Cloud Service #74

mrmvergeer opened this issue Jul 19, 2020 · 2 comments

Comments

@mrmvergeer
Copy link

I am trying to access a wav-file in a bucket om Google Cloud Services,
I get the following error:

2020-07-19 20:22:05 -- Using Google Storage URI: gs://test.wav
ℹ 2020-07-19 20:22:06 > Request Status Code: 403
Error: API returned: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.iam.gserviceaccount.com does not have storage.objects.get access to the Google Cloud Storage object.

According to this thread, it could be due to certain roles on the cloud service: https://stackoverflow.com/questions/51410633/service-account-does-not-have-storage-objects-get-access-for-google-cloud-storag
But I tried several additional roles but was not able to solve it. Any assistance is appreciated. Thank you

Below the code I am using, based on the package vignette.

rm(list = ls())
library(googleLanguageR)
my_config <- list(sampleRateHertz = 44100,
                  enableSeparateRecognitionPerChannel = TRUE,
                  audioChannelCount = 2,
                  languageCode = "nl-NL"
)
test_gcs <- "gs://test.wav"
gcs <- gl_speech(test_gcs, sampleRateHertz = 44100, asynch = TRUE)
gl_speech_op(gcs)
@MarkEdmondson1234
Copy link
Collaborator

Sure you need to add the service key in the JSON file you used to authenticate (via the GL_AUTH environment argument) as a user to the Google Cloud Storage bucket you need.

If you have a look in the json file you can see an entry for the email, it should look something like sa-name@project-id.iam.gserviceaccount.com - that email should be added as a "Storage User" for the bucket. You can do that in the Cloud Storage web UI via the Permissions tab, or in the general Google Cloud console in the IAM section, or if you want to keep it within R googleAuthR has a function gar_service_grant_roles() that can be used.

There is a Google help article here about it: https://cloud.google.com/iam/docs/granting-changing-revoking-access#granting-console - you are adding the service account.

I would just note that the test_gcs in your example would look something like "gs://bucket-name/test.wav" e.g. including the bucket name just in case that is a factor.

@mrmvergeer
Copy link
Author

I had the service key in the .Renviron, so that worked.
My mistake was to use my personal email, instead of the service key.
Thanks! Looking forward using your package for some extensive transcribing :-)

best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants