bucket names must be lowercase. There are a number of other restrictions as well - please see https://developers.google.com/storage/docs/bucketnaming#requirements
Bucket insert fails with error code 400
-
04-07-2023 - |
Question
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
Solution
OTHER TIPS
Your project name is wrong, you need the one of the form foo-barbar-12345 that Google assigned, not the plain name that you gave it (CloudStorage)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow