1

I am the tech admin for a web app, and we integrate with Drive to allows users to upload files that already exist in their drive folders. In the past day or two, we have been receiving a large number of 500 errors when executing a Files.copy command. Our logs tell us that the error is "{ error: { errors: [ [Object] ], code: 500, message: 'Internal Error' } } ".

Any advice on how to reduce the number of times this error occurs? we are estimating that this happens for 1/4 of our requests to the Google Drive SDK.

More info, as requested:

Here is the code used to copy a file to drive.

copyDriveFile = (file, callback) ->
    driveRequest({
        url: "https://www.googleapis.com/drive/v2/files/#{file.id}/copy?key=omitted"
        method: "POST"
        params:
            fileId: file.id
        json:
            title: file.name
        jwt: 
            email: "my-account@developer.gserviceaccount.com"
            keyFile: "file-key.pem"
            scopes: ['https://www.googleapis.com/auth/drive']
        },(err, res, body) ->
            callback err, res, body
            )
TJC
  • 717
  • 3
  • 12
  • Can you provide more details on what you are trying to copy? An explicit command that fails and the full http response? – Cheryl Simon Apr 30 '14 at 17:32
  • Hi Cheryl - I've added a copy of the code that is producing the issue. The file variable is a Google Drive file object. driveRequest is a method that simplifies generating the JWT auth info. Information on it can be found here: https://www.npmjs.org/package/google-oauth-jwt I am working on getting a full copy of the http response for you. – TJC Apr 30 '14 at 18:13
  • What do you mean by a Google Drive file object? What is the mimeType? – Cheryl Simon Apr 30 '14 at 18:40
  • By a Drive file object, I mean wht is returned from this request: https://developers.google.com/drive/v2/reference/files/get And the mime type is always either one of the native Google formats (sheet, document, presentation), or it is a pdf. – TJC Apr 30 '14 at 18:54
  • You see the 500's equally on all those different types? – Cheryl Simon Apr 30 '14 at 19:25
  • I believe so, yes. I have personally been able to reproduce the error occasionally using Google Doc files. So far today my app has seen ~1500 requests to drive, and 400 of those have resulted in an internal server error being returned from Google. This information is recognized on the Google Developers Console for my app. Since posting this, I have implemented a linear backoff that uses a maximum of 5 tries for the copy at increasing intervals to reduce the number of errors our users see. – TJC Apr 30 '14 at 19:38
  • That sounds like the correct approach for now. If you have a particular doc id you can share that is consistently failing, it would be useful, but I'll look and see if I can repro. – Cheryl Simon Apr 30 '14 at 19:50
  • Hi Cheryl - So every time I receive a 500 error from your servers, I log the error parameter, followed by the resp(onse) parameter. The error parameter is always "{"error":{"errors":[{"domain":"global","reason":"internalError","message":"Internal Error"}],"code":500,"message":"Internal Error"}}" and the response parameter is always "connections property is deprecated. Use getConnections() method" – TJC May 01 '14 at 14:53
  • I've done some more searching, and the error sppears to only occur when I do not have permission to copy the file using my services account. Normally I receive a 404 file not found when I lack permission to copy it, but occasionally I am receiving a 500 Internal Server Error instead. A file ID I experienced this with is 1AY4MKHk6FhjEK0OVDBtlq4eZ2uFlCPXupEWyIZGT6bs. Hopefully this helps. – TJC May 06 '14 at 19:04
  • Thanks for following up.. we still haven't been able to repro this specifically, could you provide your app id so we can try to track your requests? If you prefer, send it in email to drivemobiletest@gmail.com Thanks! – Cheryl Simon May 06 '14 at 20:54
  • App Id has been sent. Hopefully we can come to a resolution. – TJC May 07 '14 at 00:11
  • The team was able to identify the issue and pushed a fix. Can you confirm? – jonathanberi May 13 '14 at 17:13
  • Our error rate was lower today than it has been since I posted this question. If I cannot completely verify this fix tomorrow, I will post again, but the fix appears to have worked. – TJC May 14 '14 at 00:36
  • Hi Cheryl - This issue seems to be happening again. We can reliably reproduce it by creating a new private document in a private account, and attempting to copy it from a services account. The error is different this time though. `{"error":{"code":500,"message":null}}` is the body of the response we are receiving from the Google servers. This error is happening every time for us, and is debilitating the performance of our application. – TJC May 23 '14 at 14:51
  • I'm also seeing this issue. – JagWire Jun 19 '14 at 20:17
  • I'm seeing this issue now with https://yourcelf.github.io/TimelineJS-editor. API request code: https://github.com/yourcelf/TimelineJS-editor/blob/master/src/js/goog.js#L220-L238 . The request is POST https://content.googleapis.com/drive/v2/files/0AppSVxABhnltdEhzQjQ4MlpOaldjTmZLclQxQWFTOUE/copy?alt=json with body {"description":"Timeline JS template copy","labels.restricted":false,"title":"Timeline: Test 2015-07-01 13:43","writersCanShare":true}. Response is code 500, domain global, reason Internal Error. – user85461 Jul 01 '15 at 19:48
  • Yeah, this is still a widespread issue that Google doesn't seem capable of fixing. I've gone back and forth about 5 different times with their enterprise support now, but no matter how much information I give them, they can't figure it out. I even reproduced it in just my browser over screenshare using the API explorer. We see this error hundreds of times per day, but the only solution is to use a job queue that tolerates failure and will retry with a back off. – TJC Jul 01 '15 at 23:17

0 Answers0