next-s3-upload icon indicating copy to clipboard operation
next-s3-upload copied to clipboard

[Question] Clarification regarding file upload progress number

Open nik32 opened this issue 1 year ago • 10 comments

First of all, Great library with to the point docs!!!! Thanks guys!! It really has been of great help!!!

image @ryanto In the docs it's stated that the progress number will be 'continuously' updated as file's being uploaded.


But when I am uploading a small file (lets say <10mb) - the number doesn't update [it just directly reaches from 0-100]. In case of bigger files, it does update - but that is also in big chunks [like from 0 - 40, to then directly 100. These chunks keep getting smaller as the file size increases, still it seems as if the progress bar is stuck and upload is kind of hung up!!].

Is this the intended behaviour or am I doing something wrong??

nik32 avatar Sep 14 '22 00:09 nik32

Hi @nik32 sorry I missed this question!

It should update continuously, but I think for smaller files the upload might happen in one part so the only update is 0 to 100.

If you slow your internet down in chrome dev tools (to slow 3g) does it still only update once? it would be worth trying a few scenarios with small files and slow internet to see how the progress is reported.

The AWS SDK has the ability to change part size, so we could allow that to be configured when calling uploadToS3. However, messing with the defaults can sometimes create more headaches so I'd like to avoid that if at all possible.

ryanto avatar Oct 24 '22 14:10 ryanto

Hi @ryanto, thanks for your replay!!! So I tried for 2 files [one of 900KB and the other of 5.3MB] with slow 3G, and the result was same [it was going directly from 0 to 100]!!

nik32 avatar Oct 24 '22 18:10 nik32

Ok interesting, that helps! I'll start messing with the part size and see if I can get better progress updates from the aws-sdk. If that goes well I think we can provide some sort of fix/control over how often you get updates.

It might take me a week or two to get started on this.

ryanto avatar Oct 24 '22 22:10 ryanto

However, messing with the defaults can sometimes create more headaches so I'd like to avoid that if at all possible.

Thanks @ryanto!!! Do try it, but if it ends up creating more problems at other places, leave it.

nik32 avatar Oct 25 '22 07:10 nik32

Just looked into this, and the aws-sdk has a minimum part size of 5mb, which unfortunately means that you'll only get progress updates every 5mb.

There's an issue here about using the XHR adapter when doing the upload to get faster feedback: https://github.com/aws/aws-sdk-js-v3/issues/3101

ryanto avatar Oct 27 '22 16:10 ryanto

Hi @ryanto!! sorry for the late replay and thank you for your efforts. I went into this aws/aws-sdk-js-v3#3101 and especially this one XHRHttpHandller. So do I need to implement this from our side [i.e. in our project code] or would it be better if you do it inside the library code and provide us some property to opt into it???

Also does this completely replaces fetch as our http request handler [coz in the docs they use the word 'substituted'... as seen in the screenshot below]?? If so is it really worth it to replace for jus upload progress?? image

nik32 avatar Nov 04 '22 23:11 nik32

Good catch! We'll a way to opt into other adapters (like xhr-http-handler) in this library. It might take me a little while to add that feature, but I think its the best way forward.

ryanto avatar Nov 07 '22 14:11 ryanto

@ryanto thank you for doing this!!! Take your time in doing this, as we are not in a hurry for the next month or so.

nik32 avatar Nov 08 '22 11:11 nik32

@ryanto > Also would opting into xhr-http-handler replace fetch as our http request handler [coz in the docs they use the word 'substituted'... as seen in the screenshot below]?? If so would it really worth it to replace for just upload progress??

image

nik32 avatar Nov 08 '22 11:11 nik32

@ryanto Just wondering if any progress has been made on this? I'm also noticing my upoads not reporting their progress until fully uploaded.

chriship avatar Oct 10 '23 17:10 chriship