本文介绍了谷歌驱动api上传的文件,但返回500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用服务帐户将文件上传到Google Drive。它在一段时间内没有任何问题。
从2天前开始发生500错误。

  W / System.err:com.google.api .client.googleapis.json.GoogleJsonResponseException:500内部服务器错误
W / System.err:{
W / System.err:code:500,
W / System.err: message:null
W / System.err:}

但是有文件上传成功,如果我去在网络gdrive帐户,并只有成功使用控制台也。 (只有200个回复)

解决方案

基于' 500:后端错误'是处理请求时发生的意外错误。建议的操作是使用。 b

指数退避是网络应用程序的一种标准错误处理策略,客户机会在其中周期性地重试失败的请求。指数回退可能是处理这些错误的好策略。



您也可以检查这个与堆栈溢出相关的故障单,讨论其他一些工作:


I'm uploading file to google drive by using service account. And It worked w/o any problem for a while.And it started giving 500 error from 2 days ago.

W/System.err: com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error
W/System.err: {
W/System.err:   "code" : 500,
W/System.err:   "message" : null
W/System.err: }

But there is file uploaded successfully if I go to gdrive account in web and only success usage in console also. ( only 200 responses )

解决方案

Based on Official Google Documentation '500: Backend Error' is an unexpected error occurred while processing the request. The suggested action is to use exponential backoff.

Exponential backoff is a standard error handling strategy for network applications in which the client periodically retries a failed request over an increasing amount of time. Exponential backoff may be a good strategy for handling those errors.

You may also check this stack overflow related ticket which discuss some other work around: Google Drive uploading file size limit

这篇关于谷歌驱动api上传的文件,但返回500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 00:56