AWS S3 upload progress callback not being fired

Viewed 1487

I am trying to get back progress report of my file upload to AWS S3 from a react native app. As you can see I am listening for the httpUploadProgress event and trying to print the progress. But this callback function is not being called. What am I missing here?

    AWS.config.update({
       region: AWS_REGION,
       accessKeyId: user.credentials.AccessKeyId,
       secretAccessKey: user.credentials.SecretKey,
       sessionToken: user.credentials.SessionToken
    });
    const imageArrayBuffer = decode(image.data);
    const s3 = new AWS.S3();
    const params = {
        Bucket: BUCKET_NAME,
        Key: photoKey,
        Body: imageArrayBuffer,
        ContentType: image.type
    };

    s3
        .upload(params)
        .on('httpUploadProgress', function(evt) {
            console.log(
                'Uploaded :: ' + parseInt(evt.loaded * 100 / evt.total) + '%'
            );
        })
        .send(function(err, data) {
            console.log(data);
        });
0 Answers
Related