-
Notifications
You must be signed in to change notification settings - Fork 2k
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
The uploadFile function in aws-s3-multipart is not properly validating for null chunks. #4648
Comments
Are you on the latest version? This was fixed here: #4581 |
Using "@uppy/aws-s3-multipart": "3.5.3". |
Do you get the same error on |
I can confirm that I am able to reproduce the same error on 3.5.4. |
Seeing this too. I read through #4737 and am also using a self-rolled backend, and suspect it might be because I'm doing something wrong there. const uppy = new Uppy({ logger: debugLogger })
.use(AwsS3, {
shouldUseMultipart: (file: UppyFile) => true,
createMultipartUpload: (file: UppyFile) => {
return new Promise((resolve, reject) => {
// Websocket API
this.pushEventTo(
this.el,
"create_multipart_upload",
{
name: file.name,
mime_type: file.type,
size: file.size,
id: file.id,
},
(reply, ref) => {
resolve(reply);
},
);
});
}, Backend in pseudo code: function createMultipartUploadEndpoint(req) {
file = createFileInDb(
name = req.name,
client_mime = req.mime_type,
client_size = req.size,
upload_key = UUID.generate()
)
aws_upload_id = AWS.createMultiPartUpload(file)
return { uploadId: aws_upload_id, key: file.upload_key }
} I suspect this whole issue might arise because I generate a new Versions:
|
Found the problem: The AWS lib I use (Auto generated from specs) ListParts call returns ETag and PartNumber wrapped in strings. Like:
I parsed that into:
and now resume works. I can still see null-chunks in the internal structure. So might still be issues lurking around. |
Initial checklist
Link to runnable example
aws-s3-multipart
Steps to reproduce
Multipe clicks (monkey testing) of Pause / Resume buttons are throwing the following exception:
[Uppy] [11:44:50] TypeError: Cannot read properties of null (reading 'shouldUseMultipart')
at index.js:276:43
at Generator.next ()
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:25:1)
at asyncToGenerator.js:32:1
at new ZoneAwarePromise (zone.js:1429:1)
at asyncToGenerator.js:21:1
at HTTPCommunicationQueue.resumeUploadFile (index.js:274:48)
at MultipartUploader._resumeUpload2 (MultipartUploader.js:266:1)
at MultipartUploader.start (MultipartUploader.js:182:1)
Which is related to
https://github.com/transloadit/uppy/blob/main/packages/%40uppy/aws-s3-multipart/src/index.js#L283 :
if (chunks.length === 1 && !chunks[0].shouldUseMultipart) { return this.#nonMultipartUpload(file, chunks[0], signal) }
Expected behavior
There should be a check for chunk null and no error to be thrown.
Actual behavior
The type error is thrown.
The text was updated successfully, but these errors were encountered: