next-s3-upload
next-s3-upload copied to clipboard
[Question] Clarification regarding file upload progress number
First of all, Great library with to the point docs!!!! Thanks guys!! It really has been of great help!!!
![image](https://user-images.githubusercontent.com/51018572/190033790-434632d7-0c72-4e2f-9be6-51b86d6d93be.png)
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??
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.
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]!!
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.
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.
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
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??
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 thank you for doing this!!! Take your time in doing this, as we are not in a hurry for the next month or so.
@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??
@ryanto Just wondering if any progress has been made on this? I'm also noticing my upoads not reporting their progress until fully uploaded.