Authentication Google Cloud MissingSecurityHeader错误

Authentication Google Cloud MissingSecurityHeader错误,authentication,cloud,google-cloud-storage,Authentication,Cloud,Google Cloud Storage,虽然谷歌的FAQ上有一条关于这个问题的线索,但似乎只有两个答案让其他用户满意。我确信在我的网络上没有代理,并且我非常确定我已经配置了boto,因为我在请求中看到了凭据 以下是从gsutil获取的信息: ///输出消毒 Creating gs://64/... DEBUG:boto:path=/64/ DEBUG:boto:auth_path=/64/ DEBUG:boto:Method: PUT DEBUG:boto:Path: /64/ DEBUG:boto:Data: <CreateB

虽然谷歌的FAQ上有一条关于这个问题的线索,但似乎只有两个答案让其他用户满意。我确信在我的网络上没有代理,并且我非常确定我已经配置了boto,因为我在请求中看到了凭据

以下是从gsutil获取的信息:

///输出消毒

Creating gs://64/...
DEBUG:boto:path=/64/
DEBUG:boto:auth_path=/64/
DEBUG:boto:Method: PUT
DEBUG:boto:Path: /64/
DEBUG:boto:Data: <CreateBucketConfiguration><LocationConstraint>US</LocationConstraint></\
CreateBucketConfiguration>
DEBUG:boto:Headers: {'x-goog-api-version': '2'}
DEBUG:boto:Host: storage.googleapis.com
DEBUG:boto:Params: {}
DEBUG:boto:establishing HTTPS connection: host=storage.googleapis.com, kwargs={'timeout':\
 70}
DEBUG:boto:Token: None
DEBUG:oauth2_client:GetAccessToken: checking cache for key dc3
DEBUG:oauth2_client:FileSystemTokenCache.GetToken: key=dc3 present (cache_file=/tmp/o\
auth2_client-tokencache.1000.dc3)
DEBUG:oauth2_client:GetAccessToken: token from cache: AccessToken(token=ya29, expiry=2\
013-07-19 21:05:51.136103Z)
DEBUG:boto:wrapping ssl socket; CA certificate file=.../gsutil/third_party/boto/boto/cace\
rts/cacerts.txt
DEBUG:boto:validating server certificate: hostname=storage.googleapis.com, certificate ho\
sts=['*.googleusercontent.com', '*.blogspot.com', '*.bp.blogspot.com', '*.commondatastora\
ge.googleapis.com', '*.doubleclickusercontent.com', '*.ggpht.com', '*.googledrive.com', '\
*.googlesyndication.com', '*.storage.googleapis.com', 'blogspot.com', 'bp.blogspot.com', \
'commondatastorage.googleapis.com', 'doubleclickusercontent.com', 'ggpht.com', 'googledri\
ve.com', 'googleusercontent.com', 'static.panoramio.com.storage.googleapis.com', 'storage\
.googleapis.com']
GSResponseError: status=400, code=MissingSecurityHeader, reason=Bad Request, detail=A non\
empty x-goog-project-id header is required for this request.
send: 'PUT /64/ HTTP/1.1\r\nHost: storage.googleapis.com\r\nAccept-Encoding: iden\
tity\r\nContent-Length: 98\r\nx-goog-api-version: 2\r\nAuthorization: Bearer ya29\r\nU\
ser-Agent: Boto/2.9.7 (linux2)\r\n\r\n<CreateBucketConfiguration><LocationConstraint>US</\
LocationConstraint></CreateBucketConfiguration>'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Content-Type: application/xml; charset=UTF-8^M
header: Content-Length: 232^M
header: Date: Fri, 19 Jul 2013 20:44:24 GMT^M
header: Server: HTTP Upload Server Built on Jul 12 2013 17:12:36 (1373674356)^M
创建gs://64/。。。
调试:boto:path=/64/
调试:boto:auth_path=/64/
调试:boto:Method:PUT
调试:boto:Path:/64/
调试:boto:Data:US
调试:boto:Headers:{'x-goog-api-version':'2'}
调试:boto:Host:storage.googleapis.com
调试:boto:Params:{}
调试:boto:建立HTTPS连接:host=storage.googleapis.com,kwargs={'timeout':\
70}
调试:boto:标记:无
调试:oauth2_客户端:GetAccessToken:检查缓存中的密钥dc3
调试:oauth2\u客户端:FileSystemTokenCache.GetToken:key=dc3存在(cache\u file=/tmp/o\
auth2_client-tokencache.1000.dc3)
调试:oauth2_客户端:GetAccessToken:缓存中的令牌:AccessToken(令牌=ya29,到期日=2\
013-07-19 21:05:51.136103Z)
调试:boto:包装ssl套接字;CA证书文件=…/gsutil/third_party/boto/boto/cace\
rts/cacerts.txt
调试:boto:验证服务器证书:hostname=storage.googleapis.com,证书ho\
sts=['*.googleusercontent.com'、'*.blogspot.com'、'*.bp.blogspot.com'、'*.commondatastora'\
“*.doubleclickusercontent.com”、“*.ggpht.com”、“*.googledrive.com”和“*.googledrive.com”\
*.googlesyndication.com'、'*.storage.googleapis.com'、'blogspot.com'、'bp.blogspot.com'\
“commondatastorage.googleapis.com”、“doubleclickusercontent.com”、“ggpht.com”、“googledri”\
com、googleusercontent.com、static.panoramio.com.storage.googleapis.com、storage\
.googleapis.com']
GSResponseError:status=400,code=MissingSecurityHeader,reason=Bad Request,detail=A non\
此请求需要空的x-goog-project-id标头。
send:'PUT/64/HTTP/1.1\r\n主机:storage.googleapis.com\r\n接受编码:iden\
标题\r\n内容长度:98\r\nx goog api版本:2\r\n授权:承载ya29\r\nU\
服务器代理:Boto/2.9.7(linux2)\r\n\r\nUS'
答复:“HTTP/1.1 400错误请求\r\n”
标题:内容类型:application/xml;字符集=UTF-8^M
标题:内容长度:232^M
标题:日期:2013年7月19日星期五20:44:24 GMT^M
标题:服务器:HTTP上载服务器构建于2013年7月12日17:12:36(1373674356)^M

看起来您可能没有在
.boto
文件中指定
默认项目id

它应该是这样的:

[GSUtil]
default_project_id = 1234567890
或者,您可以将
-p
选项传递给
gsutil mb
命令以手动指定项目。从文件中:

-p proj_id  Specifies the project ID under which to create the bucket.

将项目ID与请求一起发送完成了任务。我发现在导航到控制台后,我错过了输入项目ID的提示。很高兴我能提供帮助。欢迎来到StackOverflow!