我试图在Unity内部的S3存储桶之间传输文件,并运行到我无法找到文档的神秘错误。两个桶都属于同一个帐户。在Unity中的Amazon S3存储桶之间传输文件
每当我创建资产时,我都会将它上传到Dev Bucket中的S3服务器,这很好用。当我准备好提交资产时,我想查看Prod Bucket中缺失的资产列表,并将其从Dev Bucket转移过来。从我的研究中,IAmazonS3. CopyObjectAsync()
是应该完成这项任务的功能。 IAmazonS3.CopyObject()
function是而不是在亚马逊的Unity SDK中可用。
这里是我打电话试图复制对象的代码:
public void TestCopy()
{
var request = new CopyObjectRequest()
{
SourceBucket = mLoginData.DevBucket,
SourceKey = "myPic.jpg",
DestinationBucket = mLoginData.ProdBucket,
DestinationKey = "myPic.jpg"
};
AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
Client.CopyObjectAsync(request,(responseObj) =>
{
if (responseObj.Exception == null)
{
ResultText.text += "Copied Object";
}
else
{
ResultText.text += "Got Exception: \n" + responseObj.Exception.ToString();
}
});
}
这导致未在Amazon Error Code documentation提到了“感动”错误代码:
Got Exception:
Amazon.S3.AmazonS3Exception: Error making request with Error Code Moved and Http Status Code Moved. No further error information was returned by the service. Response Body: Encountered invalid redirect (missing Location header?) ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.Internal.UnityRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at Amazon.Runtime.Internal.HttpHandler`1[System.String].GetResponseCallbackHelper (System.Object state) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException (IExecutionContext executionContext, Amazon.Runtime.Internal.HttpErrorResponseException exception) [0x00000] in <filename unknown>:0
at Amazon.Runtime.Internal.ExceptionHandler`1[T].Handle (IExecutionContext executionContext, System.Exception exception) [0x00000] in <filename unknown>:0
at Amazon.Runtime.Internal.ErrorHandler.ProcessException (IExecutionContext executionContext, System.Exception exception) [0x00000] in <filename unknown>:0
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsyncCallback (IAsyncExecutionContext executionContext) [0x00000] in <filename unknown>:0
我知道我设置正确,因为我能够查看/列出存储区,上传/列出/删除文件到这两个存储区等。解决方案从Unity编辑器执行至关重要。
这些新桶是? –
不,这些桶已经有很多东西在过去4个月左右的时间里使用 –