I got exception while I am using java library google-api-services-storagetransfer
to call Google Storage Transfer API
.
Failed to obtain the location of the Google Cloud Storage (GCS) bucket ________ due to insufficient permissions. Please verify that the necessary permissions have been granted.
(Full Error Message is at bottom)
But even if I gave my service account Owner
role. This error still occurs.
While I was debugging without clue, here is what I tried
- using another service account
- assign more role to my service account
- using another gs bucket
Only when I using some gs bucket as GcsDataSink
It works (without exception Failed to obtain the location of the Google Cloud Storage (GCS) bucket ________ due to insufficient permissions
)
But bucket I want to use as GcsDataSink does not.
How can I debug this problem further? Any advice?
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Failed to obtain the location of the Google Cloud Storage (GCS) bucket ________ due to insufficient permissions. Please verify that the necessary permissions have been granted.",
"reason" : "failedPrecondition"
} ],
"message" : "Failed to obtain the location of the Google Cloud Storage (GCS) bucket ______ due to insufficient permissions. Please verify that the necessary permissions have been granted.",
"status" : "FAILED_PRECONDITION"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at GoogleStorageTransferFacade$.createJobForTianjinReplica(GoogleStorageTransferFacade.scala:65)
at GoogleStorageTransferFacade$.main(GoogleStorageTransferFacade.scala:74)
at GoogleStorageTransferFacade.main(GoogleStorageTransferFacade.scala)