2013-08-22 19 views
4

似乎Google Drive API方法文件()。patch(,).execute()已經停止工作並且拋出異常。如果您「嘗試」,Google的參考頁面https://developers.google.com/drive/v2/reference/files/patch也可以觀察到此問題。驅動器API文件修補方法失敗,出現「先決條件失敗」「conditionNotMet」

的異常反應是:

500 Internal Server Error 

cache-control: private, max-age=0 
content-encoding: gzip 
content-length: 162 
content-type: application/json; charset=UTF-8 
date: Thu, 22 Aug 2013 12:32:06 GMT 
expires: Thu, 22 Aug 2013 12:32:06 GMT 
server: GSE 

    { 
    "error": { 
     "errors": [ 
     { 
     "domain": "global", 
     "reason": "conditionNotMet", 
     "message": "Precondition Failed", 
     "locationType": "header", 
     "location": "If-Match" 
     } 
     ], 
     "code": 500, 
     "message": "Precondition Failed" 
    } 
    } 

這是真正影響我們的應用程序。

回答

1

這裏重複Getting 500: Precondition Failed when Patching a folder. Why?

我回想起說:「用更新的補丁,而不是因爲它有一個內部服務器少往返」的開發一部影片的評論。我從中推斷出Patch檢查etags,但Update沒有。我已更改我的代碼以使用更新代替修補程序,並且此問題自此以後未再發生。

得愛開發針對移動目標;-)

+0

使用更新,而不是修補是可取的,迄今爲止已爲我工作。感謝您的建議。沒有關於Google修復Patch()或爲什麼破解的消息。 – bleeper

2

我們也在遇到這種情況。快速修復的解決方案是添加此標頭:If-Match: *(理想情況下,您應該使用實體的etag,但您現在可能沒有解決衝突的邏輯)。

Google開發人員,如果您打算部署重大更改,請提供給我們。

+0

感謝您的提示,我會考慮實施您的快速修復。您會認爲Google會在部署更改之前運行單元測試。這裏顯然有些東西溜過去了。 – bleeper

2

看起來像某個時候在過去的24小時內Files.Patch問題已經被放回到它是如何作爲每工作22月我們 也達不到這個問題,每當我們試圖修補文件的上次更改時間戳 - 查看日誌下面的文件摘錄:

20130826 13:30:45 - GoogleApiRequestException: retry number 0 for file patch of File/Folder Id 0B9NKEGPbg7KfdXc1cVRBaUxqaVk 
20130826 13:31:05 - ***** GoogleApiRequestException: Inner exception: 'System.Net.WebException: The remote server returned an error: (500) Internal Server Error. 
    at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
    at Google.Apis.Requests.Request.InternalEndExecuteRequest(IAsyncResult asyncResult) in c:\code.google.com\google-api-dotnet-client\default_release\Tools\BuildRelease\bin\Debug\output\default\Src\GoogleApis\Apis\Requests\Request.cs:line 311', Exception: 'Google.Apis.Requests.RequestError 
Precondition Failed [500] 
Errors [ 
    Message[Precondition Failed] Location[If-Match - header] Reason[conditionNotMet] Domain[global] 
] 
' 
20130826 13:31:07 - ***** Patch file request failed after 0 tries for File/Folder 0B9NKEGPbg7KfdXc1cVRBaUxqaVk 

今天的同一過程的運行是成功的,只要它補丁文件的時間戳,只是因爲它是前八月22.

由於這個4/5天的故障,我們現在有數百個(可能是數千個)帶有錯誤時間戳的文件。

我知道API是測試版,但請您請Google開發者「提前告知我們任何'試用修復程序'」,並且至少在此論壇發帖以確認問題,以節省我們的時間,試圖找到故障我們的用戶程序。