So i am having some trouble with the gcloud plugin for Node.
I can create a bucket manually via their GUI and then use that container just fine to write files in my node program using the gcloud library provided by google.
The problem comes when i try to create a new bucket.
storage.createBucket('bucket1', function(err, bucket) {
console.log(err)
console.log(bucket)
});
This always returns:
{ [Error: Invalid argument.]
errors:
[ { domain: 'global',
reason: 'invalid',
message: 'Invalid argument.' }],
code: 400,
message: 'Invalid argument.}
So i get that it thinks that i am passing an "invalid argument" having said that in this so helpful message 3 times ... yet the bucket name i am using is unique for my google storage. It follows the naming conventions to the best of my knowledge.
Any insights are most welcome.
Here is the string i use for setting up the link:
storage = gcloud.storage({
keyFilename: __dirname + '/../credentials/XXXXXXXX-b1e05a5128e9.json',
projectId: 'XXXXXXXX'
});
Note that i am not having any trouble reading and writing to a bucket that i created manually via the GUI. Just cannot create a new bucket.
I also tried with what should be a unique name globally across all of the cloud storage:
'com-missingmarble-bucket1'
Edit: Giving the API test as per steven's suggestion yields the same response. I authenticated the browser with oAuth ... a little different than the auth done in the node api but the result is the same. while it is possible that i did not format my request in the API tester correctly here is what i get:
Request:
POST https://www.googleapis.com/storage/v1/b?project=XXXXXXXXX&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer xxxxxxxxxx
X-JavaScript-User-Agent: Google APIs Explorer
{
"name": "com-missingmarble-bucket1"
}
Response:
400 Bad Request
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid argument."
}
],
"code": 400,
"message": "Invalid argument."
}
}