Checkboxes for prior research
Describe the bug
It seems like the partSize option in the Upload class constructor is silently ignored due to an internal computation which results in the default part size of 5 MB.
To reproduce this, I was trying to upload a ~6.5 GB file and pass in a partSize of 50 or 100 MB (50 * 1024 * 1024 or 100 * 1024 * 1024), and found that the parts were always 5 MB no matter what I specified.
After inspecting the internals of the Upload object instance, it does seem like the partSize was 5 MB, and the one I specified was not used. Looking at the code, I think this line is the reason:
|
this.partSize = Math.max(Upload.MIN_PART_SIZE, Math.floor((this.totalBytes || 0) / this.MAX_PARTS)); |
When I pass in a Body stream that is 7019552768 bytes (~6.5 GB), it assigns this.partSize to the result Math.max(Upload.MIN_PART_SIZE = 5 * 1024 * 1024 = 5 MB, 7019552768 / 10000 = 701955.2768 = 0.66 MB), which of course takes the 5 MB over the 0.66 MB. It doesn't look at options.partSize at all.
Regression Issue
SDK version number
@aws-sdk/client-s3@3.896.0
@aws-sdk/lib-storage@3.896.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v24.8.0
Reproduction Steps
Try to create an upload using the Upload class and specify a custom partSize that is larger than 5 MB.
Observed Behavior
options.partSize is ignored
Expected Behavior
options.partSize is respected, assuming it is within the minimum and maximum values (5 MB -> 5 GiB)
Possible Solution
I am able to workaround this issue by overriding the MIN_PART_SIZE property, but it's not ideal:
/* @ts-ignore */
Upload.MIN_PART_SIZE = PART_SIZE;
Additional Information/Context
No response
Checkboxes for prior research
Describe the bug
It seems like the
partSizeoption in theUploadclass constructor is silently ignored due to an internal computation which results in the default part size of 5 MB.To reproduce this, I was trying to upload a ~6.5 GB file and pass in a
partSizeof 50 or 100 MB (50 * 1024 * 1024or100 * 1024 * 1024), and found that the parts were always 5 MB no matter what I specified.After inspecting the internals of the
Uploadobject instance, it does seem like thepartSizewas 5 MB, and the one I specified was not used. Looking at the code, I think this line is the reason:aws-sdk-js-v3/lib/lib-storage/src/Upload.ts
Line 96 in ad1514d
When I pass in a
Bodystream that is 7019552768 bytes (~6.5 GB), it assignsthis.partSizeto the resultMath.max(Upload.MIN_PART_SIZE = 5 * 1024 * 1024 = 5 MB, 7019552768 / 10000 = 701955.2768 = 0.66 MB), which of course takes the 5 MB over the 0.66 MB. It doesn't look atoptions.partSizeat all.Regression Issue
SDK version number
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v24.8.0
Reproduction Steps
Try to create an upload using the
Uploadclass and specify a custompartSizethat is larger than 5 MB.Observed Behavior
options.partSizeis ignoredExpected Behavior
options.partSizeis respected, assuming it is within the minimum and maximum values (5 MB -> 5 GiB)Possible Solution
I am able to workaround this issue by overriding the
MIN_PART_SIZEproperty, but it's not ideal:Additional Information/Context
No response