msgraph-sdk-javascript icon indicating copy to clipboard operation
msgraph-sdk-javascript copied to clipboard

Large File Upload - retry doesn't work for StreamUpload

Open mdybich opened this issue 5 years ago • 2 comments

Bug Report

Description

It looks like the retry for the large file upload doesn't work for StreamUpload. When the resume is invoked, in the first step the getStatus method is called in order to update expiry and nextRange properties - at this step everything is fine.

After properties are properly updated, the upload is called and then sliceFile() from the StreamUpload that is causing a problem - it should read the bytes that should be retried, but instead, it's just getting next portion of bytes which seems to be not correct since the bytes that should be retired are not read from the stream.

Steps to Reproduce

Call resume method when the StreamUpload is passed to the LargeFileUploadTask:

function test(): Promise<any> {
   const fileObject = new StreamUpload(readStream, data.fileName, data.fileSize);
   const uploadTask = new LargeFileUploadTask(client, fileObject, uploadSession);

  try {
    await uploadTask.upload();
  } catch(error) {
    await uploadTask.resume();
  }
}

Expected behavior: The upload is properly resumed for the stream data.

Actual behavior: The retry doesn't work for the stream data.

Usage Information

SDK Version - 3.0.0-Preview.1

AB#9415

mdybich avatar May 12 '21 08:05 mdybich

@mdybich Thank you for reporting this issue! I will take a look at it.

nikithauc avatar May 12 '21 18:05 nikithauc

@mdybich A fix for this has been released in https://www.npmjs.com/package/@microsoft/microsoft-graph-client/v/3.0.0-Preview.2.

nikithauc avatar Jun 08 '21 22:06 nikithauc