问题描述
从昨天开始,文件上传API会继续随机返回403。但这取决于共享点。我们的许多客户似乎没有遇到此问题,但是我们自己的共享点和新客户的共享点都存在此问题。
基本上每个上载请求都成功或返回403访问被拒绝错误。而且通常返回403:
以下是请求(客户共享点)的示例:
error: "{
↵ "error": {
↵ "code": "accessDenied",↵ "message": "Access denied",↵ "innerError": {
↵ "date": "2020-10-14T08:51:20",↵ "request-id": "cacf89c3-5dbc-4390-98a1-5d7cb9e2668d",↵ "client-request-id": "cacf89c3-5dbc-4390-98a1-5d7cb9e2668d"
↵ }
↵ }
↵}"
另一个示例(我们的共享点):
error: "{
↵ "error": {
↵ "code": "accessDenied",↵ "innerError": {
↵ "date": "2020-10-14T09:01:38",↵ "request-id": "3c23f74d-579b-41e8-aafc-a6e3b3a6d885",↵ "client-request-id": "3c23f74d-579b-41e8-aafc-a6e3b3a6d885"
↵ }
↵ }
↵}"
在共享点上没有任何更改,它一直可以正常工作,无需更改代码,也无需更改共享点上的配置。
private function uploadSmallFile(string $localFilePath,string $remoteFilePath,$conflictBehavior)
{
$route = "/sites/root/drive/items/root:$remoteFilePath:/content";
$route = $route . '[email protected]=' . $conflictBehavior;
$item = $this->client->createRequest('PUT',$route,true)
->setReturnType(Model\DriveItem::class)
->attachBody(file_get_contents($localFilePath))
->execute();
return $item;
}
解决方法
更多详细信息:
在浏览器上访问共享点很好。
使用失眠症(就像邮递员一样,但有多种用途),这就是路径(指定了Content-Type和Content-Length)的情况:
- 成功上传(201),拒绝403访问(尽管在失眠中大约有50次上传发生了两次)
{
"error": {
"code": "accessDenied","message": "Access denied","innerError": {
"date": "2020-10-15T07:34:19","request-id": "cf7f0f59-046c-4115-ab67-3f471f340dca","client-request-id": "cf7f0f59-046c-4115-ab67-3f471f340dca"
}
}
}
带有itemId:
- 仅成功上传
这很奇怪,因为我很确定它与代码无关,因为这是在与2020年6月一样古老的代码库上发生的,此后一直没有改变。
编辑:问题似乎已解决,我这边没有更改任何代码。 API相关问题。
编辑2 :问题从今天(2020年10月20日起)又回来了(至少从美国东部时间上午8点开始)