TTLabs / EvaporateJS

Javascript library for browser to S3 multipart resumable uploads
1.82k stars 207 forks source link

Page refreshing on Firefox when hitting signer url #456

Open treetop1500 opened 4 years ago

treetop1500 commented 4 years ago

I'm experiencing an odd behavior where in Firefox 66, the page seems to refresh when the signer url is hit or somewhere around that in the process. Chrome and Safari latest versions are working flawlessly.

My method for uploading is below. I'm using a PHP controller to handled signing at the /aws-signer route. I've also tried using the full URL to that route and the problem persists.

My package.json file is require evaporate.js as such "evaporate": "^2.1.4",

function uploadToS3(files,entityId)
        {
            if (isValid(files)) {

                /**
                 * evaporate.js config
                 */
                let evaporateConfig = {
                    signerUrl: "/aws-signer",
                    aws_key: "(my key)",
                    bucket: "(my bucket)",
                    computeContentMd5: true,
                    cryptoMd5Method: function (data) {
                        return AWS.util.crypto.md5(data, 'base64');
                    },
                    cryptoHexEncodedHash256: function (data) {
                        return AWS.util.crypto.sha256(data, 'hex');
                    },
                }

                return Evaporate.create(evaporateConfig)
                    .then(function (evaporate) {

                        evaporate.add(
                            {
                                file: files[0],
                                name: +timestamp+"-"+files[0].name,
                                progress: (progressValue) => updateUploadStatus(progressValue),
                                complete: (_xhr, awsKey) => console.log('Complete!', awsKey),
                            }
                        )
                        .then(function (awsObjectKey) {
                                uploadComplete(awsObjectKey);
                                console.log('File successfully uploaded to:', awsObjectKey);
                            },
                            function (reason) {
                                console.log('File did not upload sucessfully:', reason);
                            });
                    });
            } else {
                uploadError("Invalid File Type");
            }
treetop1500 commented 4 years ago

After looking at this on a staging server (the above) was occurring on my localhost, the refresh is happening at various states in the upload process, not just at the signer request.

jakubzitny commented 4 years ago

Can you please provide a full repro? We can have a look at it.