Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bucket insert fails with error code 400

Here is the code segment:

Bucket newBucket = storage.buckets().insert("MyProject", new Bucket().setName("MyBucket").setLocation("US").setStorageClass("DURABLE_REDUCED_AVAILABILITY")).execute();
 } catch (GoogleJsonResponseException e) {
      System.out.println("Exception in tryCreateBucket: "+e);
      throw e;
 }

It throws: Exception in tryCreateBucket:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid Value",
    "reason" : "invalid"
  } ],
  "message" : "Invalid Value"
}

Any thoughts on how to fix this problem?

Thanks /VK

like image 705
user3536419 Avatar asked Apr 15 '14 14:04

user3536419


1 Answers

bucket names must be lowercase. There are a number of other restrictions as well - please see https://developers.google.com/storage/docs/bucketnaming#requirements

like image 53
Mike Schwartz Avatar answered Oct 12 '22 04:10

Mike Schwartz