Im trying to upload my files to Google Drive via REST API (resumable upload).
Everything looks good (XMLHttpRequest
triggers onprogress
and onload
events), but after it (onload triggered) Google Drive PUT request fail with 500 Internal Server Error
. File not appears in my Google Drive folder. Error 500 es in xhr.onload
, not in xhr.onerror
.
Same thing if im trying to upload that file via Google Drive interface. It happens sometimes, and i haven't environment with 100% reproducing.
Filetype Adobe .DNG or Canon .CR2 and filesize ~28MB.
What im doing wrong? Is it known bug or limitations to filetypes or file?
Possible reasons: filesize limitations, filetype limitations, or maybe my token is expires while my file is uploading?
UPD: Im using this uploader as is, only with cosmetic changes.
Im trying to upload my files to Google Drive via REST API (resumable upload).
Everything looks good (XMLHttpRequest
triggers onprogress
and onload
events), but after it (onload triggered) Google Drive PUT request fail with 500 Internal Server Error
. File not appears in my Google Drive folder. Error 500 es in xhr.onload
, not in xhr.onerror
.
Same thing if im trying to upload that file via Google Drive interface. It happens sometimes, and i haven't environment with 100% reproducing.
Filetype Adobe .DNG or Canon .CR2 and filesize ~28MB.
What im doing wrong? Is it known bug or limitations to filetypes or file?
Possible reasons: filesize limitations, filetype limitations, or maybe my token is expires while my file is uploading?
UPD: Im using this uploader as is, only with cosmetic changes.
Share Improve this question edited Nov 14, 2013 at 14:11 Vlad Tsepelev asked Nov 4, 2013 at 13:44 Vlad TsepelevVlad Tsepelev 2,0461 gold badge21 silver badges32 bronze badges 9- 1 It should be fairly easy to eliminate 2 of your 3 possibilities. A filetype limitation would trigger for any file size, and I would expect a 405 status. Unless you have convert=true, Drive won't care what your file type is. If your token expires, you should get a 401. So my personal guess would be it's a bug/filesize issue. This page support.google./drive/answer/37603?hl=en says the limit for non-converted files is 10GB. – pinoyyid Commented Nov 4, 2013 at 15:40
- This is server response params:{"error":{"errors":[{"domain":"global","reason":"internalError","message":"InternalError"}],"code":500,"message":"InternalError"}} – Vlad Tsepelev Commented Nov 6, 2013 at 15:48
- I would assume it's a Drive bug unless somebody from Google confirms otherwise. You might want to try the older docs list API which seems more reliable. – pinoyyid Commented Nov 6, 2013 at 17:28
- I spotted this question stackoverflow./questions/14628024/… which confirms that if your problem was access-token expiration, that you would see a 401, not a 500. – pinoyyid Commented Nov 6, 2013 at 19:37
- 1 Does the problem occur from another Google Drive account? Does it work with a smaller file? – Nick Commented Nov 14, 2013 at 9:51
3 Answers
Reset to default 5OK. I got it.
Files uploads successfully with Content-Type == "application/octet-stream". Looks like bug on GoogleDrive side with mime-type'd files. In this scenario my raw files (DNG, CR2, NEF etc.) stores in GoogleDrive with incorrect mime-type (as a result there is no preview for these files).
So i can't filter files by mime-type anymore.
Query string = (mimeType = 'image/x-adobe-dng' or mimeType = 'image/x-canon-cr2' or mimeType = 'image/x-nikon-nef').
I tried to filter files by keyword title, but looks like titles doesn't contain extension, but in response item titles contain extension.
Query string = (title contains '.dng' or title contains '.cr2' or title contains '.nef').
So i have to filter my files not by mime-type or by title, but by fullText keyword.
Query string = (fullText contains '.dng' or fullText contains '.cr2' or fullText contains '.nef').
Conclusion:
- GoogleDrive uploader checks Content-Type, even if convert option is set to false.
- GoogleDrive fails from time to time with this convertation.
- Uploader works fine with Content-Type == 'application/octet-stream'.
- GoogleDrive query string keyword title doesn't contain file extension, but in response titles have extension.
- GoogleDrive query string keyword fullText contains filename with extension (mb its not very fast for text files).
- To test your request you can use this tool https://developers.google./drive/v2/reference/files/list in the end of page.
- GoogleDrive API crashes from time to time with HTTP status 500 Internal Server Error:
{"error":{"errors":[{"domain":"global","reason":"backendError","message":"Backend Error"}],"code": 500,"message": "Backend Error"}}
I think this would be related to raw photo files, because DRIVE tries to convert them to JPG as is done in Google+, unless you specify convert=false. You should specify in your upload API to not convert that files.
This second post says that it will allow you to preview the file up to 25MB, this size limitation could be related with your troubles. Maybe you could try to upload another photo with less than that size to ensure it's not this the limitation.
I have also seen this 500 error with google analytics a few times and its normaly due to the fact that the server is busy. If I wait a bit and try again it works. Try reading this https://developers.google./drive/handle-errors#implementing_exponential_backoff This worked form me with Google Analtyics API, normaly by the time it gets to step 6 its got access again. Haven't tried it with google Drive, but then i havent tried to upload a 25m file before. But i'm betting thats your problem.