#StackBounty: #java #google-cloud-storage The account for bucket "XXX" has been disabled

Bounty: 50

Running the following code to create a new bucket on google storage, I got an error “StorageException: The account for bucket “my-new-bucket-abc” has been disabled“.

String SERVICE_ACCOUNT_JSON_PATH = "C:\gcpconfig\My First Project-6f9cff47c4f0.json";

Storage storage =
    StorageOptions.newBuilder()
        .setCredentials(
            ServiceAccountCredentials.fromStream(
                new FileInputStream(SERVICE_ACCOUNT_JSON_PATH)))
        .build()
        .getService();

String bucketName = "my-new-bucket-abc";

// Creates the new bucket
Bucket bucket = storage.create(BucketInfo.of(bucketName));

System.out.printf("Bucket %s created.%n", bucket.getName());

However, I could download the files from google storage by running the following code:

String SERVICE_ACCOUNT_JSON_PATH = "C:\gcpconfig\My First Project-6f9cff47c4f0.json";

Storage storage =
    StorageOptions.newBuilder()
        .setCredentials(
            ServiceAccountCredentials.fromStream(
                new FileInputStream(SERVICE_ACCOUNT_JSON_PATH)))
        .build()
        .getService();

BlobId blobId = BlobId.of("nmjcloud_jar_test","addons/simple-bean-1.0.jar");
Blob blob = storage.get(blobId);

Path path = Paths.get("D:\lib\simple-bean-1.0.jar");
blob.downloadTo(path);

System.out.printf("Download successfully%n");

The complete error message is as follows:

Exception in thread "main" com.google.cloud.storage.StorageException: The account for bucket "my-new-bucket-abc" has been disabled.
    at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:191)
    at com.google.cloud.storage.spi.v1.HttpStorageRpc.create(HttpStorageRpc.java:221)
    at com.google.cloud.storage.StorageImpl$2.call(StorageImpl.java:112)
    at com.google.cloud.storage.StorageImpl$2.call(StorageImpl.java:109)
    at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:89)
    at com.google.cloud.RetryHelper.run(RetryHelper.java:74)
    at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:51)
    at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:108)
    at com.example.storage.QuickstartSample.main(QuickstartSample.java:58)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "location" : "Authorization",
    "locationType" : "header",
    "message" : "The account for bucket "my-new-bucket-abc" has been disabled.",
    "reason" : "accountDisabled"
  } ],
  "message" : "The account for bucket "my-new-bucket-abc" has been disabled."
}
    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 com.google.cloud.storage.spi.v1.HttpStorageRpc.create(HttpStorageRpc.java:219)
    ... 7 more

Does it mean that the account I used doesn’t have permission to create buckets?

Some Settings about my Google Cloud Platform:

1. Billing account:
enter image description here

2. The service account key:

{
  "type": "service_account",
  "project_id": "ornate-shine-192301",
  "private_key_id": "6f9cff47c4f0f8b1263bbf515f7e3318dcc88487",
  "private_key": "-----BEGIN PRIVATE KEY-----nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHvLTQn5i0AhebnW9iUkaRpZiGACUrh694JAzckVPEdhDoLaV4ZBapnmYrJBqQIs8RFXRWajtOrjzbYnKJXWhOdtIim72fB0KVENjTRmq2m+wWf+ks19/eWakzYlXvsry61GT44UfccCOYbUnioyevhQtJ0mdpa7QtA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gB/rnv0XXWAzfKlSiazJJ2NyoZ4Bcw96ZN6jS9BEEGZNb/0pEVrWde8Fa0uE2mhXzb/QynFFT6oLIU++DH2yaHJm3Ci/Xb9WOOSAn62Vtm4a5tvHLZtSmU0TdFoQG4N4ILG/OKnIfJ6JZ29MANgXxYC4sO4VRiGaen4vPlezs4FPoBXAoGAc/h3ep+m3okykKwqL6eanoBJJ6xMiSTgvHVb9gNlVeDvRiqT7sc7Y2i/UKF2UceLQTOWssGtg/LiqvEZlMI0snU2LuyU2vdT+7Thn3hT1EfBYTOEuGIgXijGA4aLNAx4HsRx2M6HeLE277syJxBNgUn3DsGix3gso9/jJjt4p5G5II=n-----END PRIVATE KEY-----n",
  "client_email": "gcsserviceaccountname1@ornate-shine-192301.iam.gserviceaccount.com",
  "client_id": "114270155500502944764",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gcsserviceaccountname1%40ornate-shine-192301.iam.gserviceaccount.com"
}

3. Permissions for project “My First Project” :
enter image description here

4. Google Cloud Storage API Library :
enter image description here

Supplement:
1. I’m able to create buckets either using gsutil command line or GCP console.
2. Java API could download files from GCS.

Reference Links:
1. APIs & Reference
2. Cloud Storage Client Libraries


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.