I've been trying to get this very Fine Uploader (fresh from NPM - 5.12.0-alpha) set up to push some data to S3 and I've been having some issues with chunking. I have enabled chunking I believe based on the example from Concurrent Chunking but I have not seen multiple chunks being uploaded in the XHR console.
const fu = require('fine-uploader/lib/s3');
const SA = require('superagent');
let x = new fu.s3.FineUploaderBasic({
request: {
endpoint: 'they-taken-mah-bucket.s3.amazonaws.com'
},
credentials: {
accessKey: 'invalid',
expiration: new Date(),
secretKey: 'invalid',
sessionToken: 'invalid'
},
objectProperties: {
bucket: 'they-taken-my-bucket',
key: 'filename'
},
autoUpload: false,
debug: true,
callbacks: {
onComplete: function(){
moveUpload({from:'active', to:'finished', hash: activeUpload.hash}).then( function() { good(hash); });
},
onError: function(id, name, reason, xhrCache){
moveUpload({from:'active', to:'error', hash: activeUpload.hash}).then( () => bad(new Error('upload error - '+reason)) );
},
onProgress: function(id, name, uploaded, total){
const elapsed = (Date.now() - t.getTime()) / 1000;
const rate = uploaded / elapsed;
updateUploadProgress({hash: activeUpload.hash, progress: (100*uploaded/total).toFixed(0), rate: rate});
},
chunking: {
enabled: true,
concurrent: {
enabled: true
}
},
maxConnections: 5,
retry: {
enableAuto: true,
maxAutoAttempts: 10
},
onCredentialsExpired: function () {
return fetchCredentials();
}
}
});`
The behavior I'm seeing: http://recordit.co/z5VnLR63eT
Essentially I see the OPTIONS request, that goes fine, and the upload starts correctly but I only see 1 outbound connection - and the content type is not what I would expect, it's multipart form instead of raw. Though perhaps I'm wrong in this expectation, I would have expected it to just be a raw bin post.
Any advice would be most appreciated.
Your options are not set correctly, and this is why concurrent chunking is not enabled.
You defined the chunking
option inside of the callbacks
section. Move it out of callbacks
(along with maxConnections
and retry
).