0
votes

String projName = settings.getProject(); String bucketName = settings.getBucket();

System.out.println("Creating bucket, projName: "+projName+", bucketName: "+bucketName) ;
try {
  @SuppressWarnings("unused")
  Bucket createdBucket = storage.buckets().insert(projName, 
      new Bucket().setName(bucketName).setLocation("US")
    ).execute();
} catch (GoogleJsonResponseException e) {
  GoogleJsonError error = e.getDetails();
  if (error.getCode() == HTTP_CONFLICT
      && error.getMessage().contains("You already own this bucket.")) {
    System.out.println("already exists");
  } else {
    System.out.println("Exception in tryCreateBucket: "+e);
    throw e;
  }
}

Output:

Creating bucket, projName: round-center-551, bucketName: 1904mybucketfoo

Exception in tryCreateBucket:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden

{ "code" : 403, "errors" : [ { "domain" : "global" "location" : "Authorization", "locationType" : "header", "message" : "The account for the specified project has been disabled.", "reason" : "accountDisabled" } ], "message" : "The account for the specified project has been disabled." } The account for the specified project has been disabled.

I have verified that Google Cloud Storage and Google Cloud Datastore API services are on. Any idea what should be done to enable the account?

1
Have you enabled billing for your project? You can only create a bucket if billing has been set up for that project.Brandon Yarbrough

1 Answers

5
votes

This error could mean a few things, but quite possibly just means that you haven't enabled billing for the project.

Google Cloud Storage requires that billing is enabled in order to create buckets and objects, however the error here isn't very descriptive.

You can enable billing on the Settings page for your project in the Cloud Console (https://console.developers.google.com/project/apps~PROJECT_NAME/settings)