将文件上传到 AWS 时随机 ACM 检查失败

问题描述 投票:0回答:1

正如标题所示,我正在使用 Autodesk API (C#) 在 AWS 存储桶中上传对象。

由于某种原因,有时我会遇到以下异常:

System.AggregateException: One or more errors occurred. (Error calling UploadChunk: {"developerMessage":"ACM check failed, user or calling service does not have access to perform this operation","userMessage":"","errorCode":"AUTH-012","more info":"https://developer.api.autodesk.com/documentation/v1/errors/AUTH-012"})
 ---> Autodesk.Forge.Client.ApiException: Error calling UploadChunk: {"developerMessage":"ACM check failed, user or calling service does not have access to perform this operation","userMessage":"","errorCode":"AUTH-012","more info":"https://developer.api.autodesk.com/documentation/v1/errors/AUTH-012"}
   at Autodesk.Forge.ObjectsApi.UploadChunkAsyncWithHttpInfo(String bucketKey, String objectName, Nullable`1 contentLength, String contentRange, String sessionId, Stream body, String contentDisposition, String ifMatch, String contentType)
   at Autodesk.Forge.ObjectsApi.UploadChunkAsync(String bucketKey, String objectName, Nullable`1 contentLength, String contentRange, String sessionId, Stream body, String contentDisposition, String ifMatch, String contentType)

我尝试复制该错误,但我只是随机得到它。 我还实现了重试策略,以在出现异常时调用 API,但结果不会改变,即使下一个调用也会返回异常。

我确信凭据和信息是正确的,他们正在处理其他上传的内容。

是否有可能令牌身份验证已过期,并且我必须等待 2 秒以上(由我设置的实际睡眠时间)才能通过 Autodesk API 对象接收 AWS 存储桶的新令牌?

amazon-web-services amazon-s3 autodesk-forge autodesk autodesk-designautomation
1个回答
0
投票

您收到的错误

AUTH-012: The Authorization header is missing or invalid.
对我来说表明您的令牌很可能在使用过程中过期。

您的应用程序是否遵循 AutoDesk 文档中描述的“三足身份验证/授权”工作流程,其中还描述了何时/如何刷新令牌过期

顺便说一句,您正在使用 API 的 v1,该 API 自 2024 年 4 月起已被弃用

© www.soinside.com 2019 - 2024. All rights reserved.