Bug Report
I'm using msgraph-sdk-javascript in NodeJs and try attach a document in Outlook email. The issue is, LargeFileUploadTask.uploadSlice function returns PassThrough readable stream on end of file upload instead of JSON response with id.
Prerequisites
Steps to Reproduce
-
Create an Outlook draft message by usingPostman.
-
Create a simple HttpTrigger Azure Function and Add following code in Azure Function handler.
const saveAttachment = async (oid, tenantId, messageId, file) => {
// getClient is just creating client with GraphToken generate authProvider.
// authProvider is doing client-credential flow to generate token.
const client = await getClient(tenantId);
const uploadSessionPayload = {
AttachmentItem: {
attachmentType: 'file',
name: file.filename,
size: file.size
}
};
const uploadSession = await LargeFileUploadTask.createUploadSession(
client,
`/users/${oid}/messages/${messageId}/attachments/createUploadSession`,
uploadSessionPayload,
);
const fileObject = {
content: file.data,
name: file.filename,
size: file.size
};
const { url: uploadUrl } = uploadSession;
const uploadUrlTokens = uploadUrl.split('?');
const uploadUrlAuthToken = uploadUrlTokens[1].replace('authtoken=', '');
const uploadClient = Client.init({
authProvider: (done) => done(null, uploadUrlAuthToken),
debugLogging: true
});
const uploadTask = new LargeFileUploadTask(uploadClient, fileObject, uploadSession, {
rangeSize: 5 * 1024 * 1024,
});
const uploadResponse = await uploadTask.upload();
return uploadResponse;
};
-
Execute AzureFunction in Visual Studio Code.
-
Call HttpTrigger from Postman
Expected behavior:
Large file should be uploaded in sequential PUT call. In end of all chunks upload, LargeFileUploadTask.uploadSlice function should give response with 'id'

Actual behavior:
LargeFileUploadTask.uploadSlice function is giving NodeJs ReadableStream.
Additional Context


Code Line:
AB#7549
Bug Report
I'm using msgraph-sdk-javascript in NodeJs and try attach a document in Outlook email. The issue is, LargeFileUploadTask.uploadSlice function returns PassThrough readable stream on end of file upload instead of JSON response with id.
Prerequisites
I'm using 2.1.1 as of 19th Nov 2020
Steps to Reproduce
Create an Outlook draft message by usingPostman.
Create a simple HttpTrigger Azure Function and Add following code in Azure Function handler.
Execute AzureFunction in Visual Studio Code.
Call HttpTrigger from Postman
Expected behavior:
Large file should be uploaded in sequential PUT call. In end of all chunks upload,
LargeFileUploadTask.uploadSlicefunction should give response with 'id'Actual behavior:
LargeFileUploadTask.uploadSlicefunction is giving NodeJs ReadableStream.Additional Context
Code Line:
msgraph-sdk-javascript/src/tasks/LargeFileUploadTask.ts
Line 254 in 4130614
AB#7549