Google drive api 列表文件:后端错误(无错误代码)Google Drive SDK

Google drive api 列表文件:后端错误(无错误代码)Google Drive SDK,google-drive-api,Google Drive Api,我们已经构建了一个web应用程序,可以根据用户定义的业务规则自动索引电子邮件附件并将其直接保存到Google Drive。我们在同步一些Google Drive帐户时遇到了故障,无法找出问题所在 这就是错误: 列表文件错误:后端错误 /mnt/opt/openera/current/app/models/cloud\u account/google\u drive.rb:299:在“列表文件”中 /mnt/opt/openera/current/app/models/cloud\u accoun

我们已经构建了一个web应用程序,可以根据用户定义的业务规则自动索引电子邮件附件并将其直接保存到Google Drive。我们在同步一些Google Drive帐户时遇到了故障,无法找出问题所在

这就是错误:

列表文件错误:后端错误 /mnt/opt/openera/current/app/models/cloud\u account/google\u drive.rb:299:在“列表文件”中 /mnt/opt/openera/current/app/models/cloud\u account/google\u drive.rb:220:in'do\u discover\u files' /mnt/opt/openera/current/app/models/cloud\u account/base.rb:304:在“发现文件”中 /mnt/opt/openera/current/app/workers/worker/file_synchronizer.rb:10:在“执行”中 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:45:in'块(3层)in 过程' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:109:in'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:109:in'block in in in 沃克 /mnt/opt/openera/current/lib/sidekiq_repeat_jobs/middleware/server/repeat_jobs.rb:36:in'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middledge/chain.rb:111:in'块入 沃克 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/timeout.rb:14:in'cal 我是 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in'block in in in 沃克 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/active_record.rb:6:in “呼叫” /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in'block in in in 沃克 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/retry_jobs.rb:49:in' 呼叫' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in'block in in in 沃克 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/logging.rb:11:in'blo 呼叫中的ck' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/logging.rb:22:in'with_context' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/server/logging.rb:7:in'call ' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:111:in'block in in in 沃克 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:114:in'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/middleware/chain.rb:114:in'invoke' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:44:in'块(2层)in 过程' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:80:in'stats' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/sidekiq-2.6.5/lib/sidekiq/processor.rb:43:in'block-in-process' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in'public_send' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in'dispatch' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in'block in initiali 泽 /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in'call' /mnt/opt/openera/current/vendor/bundle/ruby/1.9.1/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in'block in c 创造

更新:这是我们高级开发人员的实际代码

dev here(ffoeg)添加实际调用的代码:

def列表_文件
pageToken=nil
params={'maxResults'=>65535,'q'=>trashed=false'}
文件=[]
drive=session.discovered\u api(“drive”、“v2”)
尽管如此
call_params=pageToken.blank?params:params.merge('pageToken'=>pageToken)
结果=session.execute(api_方法:drive.files.list,参数:call_params)
如果result.status==200
文件+=result.data.items
如果结果。数据['nextPageToken']为空,则中断。是否为空?
pageToken=result.data['nextPageToken']
其他的
引发“列表文件错误:#{result.data['Error']['message']}”
结束
结束
文件夹
结束
再次更新:

我们更新了代码以获得准确的错误-如下所示:

List Files Error: {"errors"=>[{"domain"=>"global", "reason"=>"backendError", 
"message"=>"Backend Error"}], "code"=>503, "message"=>"Backend Error"}

问题在于maxResults的值。它太大,将导致请求超时。不幸的是,“安全”值非常小,每页大约有200个结果。您可以放大,但结果会因用户而异。拥有较小微粒的用户可能可以很好地处理较大的页面大小,但拥有较大微粒的用户似乎更敏感。嗯,至少基于对我的一些账户进行的一些非常快速/非正式的测试


FWIW,我记得页面越大效果越好。将检查是否有任何更改可能会限制超出预期的内容。

是否也可以添加代码?它是否总是在某些用户身上失败,而在其他用户身上成功?如果您再试一次,相同的呼叫是否有效?您是否如中所述处理错误?并非所有用户都会失败-大多数用户都会成功。此错误似乎特定于某些用户帐户。一旦某个帐户失败,无论我们打多少次电话,它都会继续失败。对不起。没有意识到“回车”会提交评论。由于我们没有得到一个特定的错误代码-我们一直无法处理这个错误,正如谷歌开发网站上所解释的-我将抓住