-
Notifications
You must be signed in to change notification settings - Fork 646
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
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
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/[email protected]
@aws-sdk/[email protected]
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