-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart upload exception when calling UploadDirectoryAsync #54
Comments
Hello @lpallarestorab, Thank you for reporting this issue. Can you kindly confirm which package version of Regards, |
Yes, it is 2.1.1 |
Hi @lpallarestorab, Using below code sample I am able to reproduce the error - static async Task Main(string[] args)
{
Amazon.AWSConfigs.LoggingConfig.LogResponses = Amazon.ResponseLoggingOption.Always;
Amazon.AWSConfigs.LoggingConfig.LogTo = Amazon.LoggingOptions.Console;
Amazon.AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener());
await UploadEncryptedFullDirectoryAsync(@"C:\**\download", null);
}
public static async Task UploadEncryptedFullDirectoryAsync(string filePath, string keyPrefix = null)
{
if (String.IsNullOrWhiteSpace(keyPrefix))
keyPrefix = Path.GetFileName(filePath);
var uploadRequest = new TransferUtilityUploadDirectoryRequest
{
BucketName = "<<bucket_name>>",
KeyPrefix = keyPrefix,
Directory = filePath,
StorageClass = S3StorageClass.Standard
};
var S3CryptoConfigurationV2 = new AmazonS3CryptoConfigurationV2(SecurityProfile.V2);
var encryptionContext = new Dictionary<string, string>();
var EncryptionMaterialsV2 =
new EncryptionMaterialsV2("<<KMS_Id>>", KmsType.KmsContext, encryptionContext);
using (AmazonS3EncryptionClientV2 s3EncryptionClient = new
AmazonS3EncryptionClientV2(S3CryptoConfigurationV2, EncryptionMaterialsV2))
{
var transferUtil = new TransferUtility(s3EncryptionClient);
await transferUtil.UploadDirectoryAsync(uploadRequest);
}
} Mentioned error is thrown when the object size >= 16 MB (Multipart upload). I will review this with the .NET SDK team to further investigate it. Regards, |
Any updates for this problem?? |
Thanks for reporting the issue. I put out a PR to address the issue: #56 |
The PR has been released as part of version |
|
Describe the bug
I´m trying to upload an entire directory client-sided KMS encrypted. The transfer starts but then the upload raise an exception when reach 5242880 bytes (file is close to 100 MB size).
Expected Behavior
success on uploading directory with big size files inside
Current Behavior
HashStream does not support base streams that are not capable of reading or writing
at Amazon.Runtime.Internal.Util.HashStream.ValidateBaseStream()
at Amazon.Runtime.Internal.Util.HashStream
1..ctor(Stream baseStream, Byte[] expectedHash, Int64 expectedLength) at Amazon.Runtime.Internal.Util.MD5Stream..ctor(Stream baseStream, Byte[] expectedHash, Int64 expectedLength) at Amazon.S3.Internal.AmazonS3PostMarshallHandler.SetStreamChecksum(UploadPartRequest uploadPartRequest, IRequest request) at Amazon.S3.Internal.AmazonS3PostMarshallHandler.SetStreamChecksum(AmazonWebServiceRequest originalRequest, IRequest request) at Amazon.S3.Internal.AmazonS3PostMarshallHandler.ProcessPreRequestHandlers(IExecutionContext executionContext) at Amazon.S3.Internal.AmazonS3PostMarshallHandler.PreInvoke(IExecutionContext executionContext) at Amazon.S3.Internal.AmazonS3PostMarshallHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.BaseEndpointResolver.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Extensions.S3.Encryption.Internal.UserAgentHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.Marshaller.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T](IExecutionContext executionContext) at Amazon.Extensions.S3.Encryption.Internal.SetupEncryptionHandler.<>n__0[T](IExecutionContext executionContext) at Amazon.Extensions.S3.Encryption.Internal.SetupEncryptionHandler.<InvokeAsync>d__11
1.MoveNext()at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Amazon.Runtime.Internal.CallbackHandler.d__9
1.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.S3.Internal.AmazonS3ExceptionHandler.<InvokeAsync>d__1
1.MoveNext()at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Amazon.Runtime.Internal.ErrorCallbackHandler.d__5
1.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1
1.MoveNext()at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Amazon.S3.Transfer.Internal.MultipartUploadCommand.d__28.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Amazon.S3.Transfer.Internal.BaseCommand.d__5
1.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Amazon.S3.Transfer.Internal.MultipartUploadCommand.<ExecuteAsync>d__27.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.S3.Transfer.Internal.BaseCommand.<ExecuteCommandAsync>d__7.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.S3.Transfer.Internal.BaseCommand.<WhenAllOrFirstExceptionAsync>d__6.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Amazon.S3.Transfer.Internal.UploadDirectoryCommand.<ExecuteAsync>d__15.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at AWSTools.S3.<TransferUtilityUploadFullDirectoryAsync>d__35.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()at RespaldosAWS.BL.RespaldosHandler.d__3.MoveNext() in F:\Proyectos\2023\RespaldosAWS\RespaldosAWS.BL\RespaldosHandler.cs:line 104
Reproduction Steps
try to upload a directory with big size file inside
public async Task UploadEncryptedFullDirectoryAsync(
string filePath, DirectoryUploadTracker uploadTracker, string keyPrefix = null)
{
if (String.IsNullOrWhiteSpace(keyPrefix))
keyPrefix = Path.GetFileName(filePath);
}
Possible Solution
No response
Additional Information/Context
When using not encrypted S3Client works perfectly
AWS .NET SDK and/or Package version used
AWSSDK.Core 3.7.304.16
AWSSDK.S3 3.7.309.4
Targeted .NET Platform
.NET 4.8.1
Operating System and version
Windows 11 Pro 23H2
The text was updated successfully, but these errors were encountered: