Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File is not uploaded sometime #4343

Open
shaangidwani opened this issue Feb 9, 2023 · 4 comments
Open

File is not uploaded sometime #4343

shaangidwani opened this issue Feb 9, 2023 · 4 comments
Labels
bug This issue is a bug. investigating Issue has been looked at and needs deep dive work by OSDS. p2 This is a standard priority issue

Comments

@shaangidwani
Copy link

shaangidwani commented Feb 9, 2023

Describe the bug

The user is trying to upload one file at that time we have captured the event progress and based on that we display the status of the file upload.

Sometimes when the user uploads the file, it shows 100%, but the file is not uploaded on the server without giving any error by the AWS js Utility.

Due to this issue, the system and user think the file is uploaded but has not been uploaded.

Expected Behavior

If the file is not uploaded on S3 it should give the proper error.

Current Behavior

Currently its not giving any error and file is not uploaded on s3

Reproduction Steps

Its random issue we have try after sometime same file is uploaded successfully without any issue with same source code

Possible Solution

Gives error so that system will not processed further and provide error to user.

Additional Information/Context

Here is the code which we are using :

bucket.upload(params, options).on('httpUploadProgress', function (evt) {
            $(".progress-bar").show();
            var Perc = parseInt((evt.loaded * 100) / evt.total);
            $(".progress-bar").html(Perc + '%');
            $(".progress-bar").attr("aria-valuenow", Perc);
            $(".progress-bar").attr("aria-valuenow", Perc);
            $(".progress-bar").css("width", Perc + '%');
            if (Perc == 100) {
                //toastrSuccess("File uploaded successfully.");
                $(".progress-bar").html(0 + '%');
                $(".progress-bar").attr("aria-valuenow", 0);
                $(".progress-bar").attr("aria-valuenow", 0);
                $(".progress-bar").css("width", 0 + '%');
                $(".progress-bar").hide();                
            }
        }).send(function (err, data) {           
            if (!err) {
                // success
            }
            else {
                alert(err + "Something went wrong while uploading file. Please try again.");
                
            }
        });

SDK version used

AWS SDK for JavaScript v2.727.1

Environment details (OS name and version, etc.)

Windows OS

@shaangidwani shaangidwani added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 9, 2023
@corymhall
Copy link

I think we are seeing this issue as well.

await s3.upload(params).promise()

@yenfryherrerafeliz
Copy link

Hi @shaangidwani, thanks for opening this issue. I tried to reproduce this but as you said seems it may happen sporadically. I will investigate this further to see if I can find a reproducible scenario that I can use to root cause the issue.

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz added investigating Issue has been looked at and needs deep dive work by OSDS. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2023
@yenfryherrerafeliz yenfryherrerafeliz added the p2 This is a standard priority issue label Mar 23, 2023
@KieranDaviesV
Copy link

I've got the exact same issue using serverless framework and uploading to s3. Works most of the time then sometimes it won''t work, couple retries later it works.

@zakhaev26
Copy link

zakhaev26 commented Jun 16, 2023

That's kinda wierd , never had this issue while uploading to s3:

const S3 = require('aws-sdk/clients/s3')
const bucketName = process.env.AWS_BUCKET_NAME
const region = process.env.AWS_BUCKET_REGION
const accessKeyId = process.env.AWS_ACCESS_KEY
const secretAccessKey = process.env.AWS_SECRET_KEY

const s3 = new S3({
  region,
  accessKeyId,
  secretAccessKey
})

//pass the file by using multer middleware 
function uploadFile(file) {
  const fileStream = fs.createReadStream(file.path)

  const uploadParams = {
    Bucket: bucketName,
    Body:fileStream ,
    Key: file.filename
  }

  return s3.upload(uploadParams).promise()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. investigating Issue has been looked at and needs deep dive work by OSDS. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

5 participants