Hello I am trying to use the google api storage dependencies to create a a bucket in google storage, the problem is that i am not being able to do it because I get this error after ejecution the code
{:error,
%Tesla.Env{
__client__: %Tesla.Client{
adapter: nil,
fun: nil,
post: [],
pre: [
{Tesla.Middleware.Headers, :call,
[
[
{"authorization",
"Bearer .."}
]
]}
]
},
__module__: GoogleApi.Storage.V1.Connection,
body: "{\n \"error\": {\n \"code\": 400,\n \"message\": \"Required\",\n \"errors\": [\n {\n \"message\": \"Required\",\n \"domain\": \"global\",\n \"reason\": \"required\"\n }\n ]\n }\n}\n",
headers: [
{"cache-control", "no-cache, no-store, max-age=0, must-revalidate"},
{"date", "Tue, 11 Jan 2022 21:36:34 GMT"},
{"pragma", "no-cache"},
{"server", "UploadServer"},
{"vary", "Origin"},
{"content-length", "191"},
{"content-type", "application/json; charset=UTF-8"},
{"expires", "Mon, 01 Jan 1990 00:00:00 GMT"},
{"x-guploader-uploadid",
"ADPycdsDF1IdzxGu0SHK7w2m_TtakLOTSAp8SVkr6AeRWIw-2VutyCBr43BVH2PtTgLhQGB8_kz0_gOLwWIT8tJv1QFm84UXPw"},
{"alt-svc",
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""}
],
method: :post,
opts: [],
query: [project: "project_id"],
status: 400,
url: "https://storage.googleapis.com/storage/v1/b"
}}
that is not very descriptive of the problem. I am getting the token with Goth and creating a connection with that but still fails. I suspect it is related to the fact that i am not passing a name to the bucket but i can’t confirm it. the documentation is not very helpfull really. the code is the next one
def create_bucket() do
{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloud-platform")
conn = GoogleApi.Storage.V1.Connection.new(token.token)
project_id = "project_Id"
{:ok, bucket} = Buckets.storage_buckets_insert(conn, project_id)
end
the project_id is a valid project name extracted from the generated keys of the project in google storage.