2013-07-19 55 views
1

雖然在Google的常見問題中有關於此問題的線索,但似乎只有兩個答案已滿足其他用戶。我確定我的網絡上沒有代理服務器,我確信我已經配置了boto,因爲我在請求中看到了憑據。Google Cloud MissingSecurityHeader錯誤

這裏是拍攝從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 

回答

0

它看起來就像在你.boto文件default_project_id指定您可能沒有。

它應該是這個樣子:

[GSUtil] 
default_project_id = 1234567890 

或者,您可以通過-p選項將gsutil mb命令來手動指定的項目。從gsutil mb文檔:

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

與請求一起發送一個項目ID有竅門。 在導航到控制檯http://code.google.com/apis/console後,我看到我錯過了項目ID的提示。 – user2600958

+0

通過項目ID做了訣竅。 – user2600958

+0

很高興我能幫到你。歡迎來到StackOverflow! – jterrace