microsoftgraph / microsoftgraph/msgraph-sdk-java
Getting: "No Response Received for upload." exception using LargeFileUploadTask
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 444
- 分支
- 154
- 平均合併
- 18 小時 28 分鐘
- 30 天內合併 PR
- 4
描述
Hello, we are experiencing this exception and we don't find much information about It so we are creating this issue because we are not sure if It is a bug or It is something else.
We are trying to upload Large Files (more than 3 MB) to a draft Outlook Message from our Java 21 Maven Project with Microsoft Graph Java SDK v6.54.0. The POM.xml dependency looks like this:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>6.54.0</version>
</dependency>
We are following the Microsoft Docs to do this: https://learn.microsoft.com/en-us/graph/sdks/large-file-upload?tabs=java#upload-large-attachment-to-outlook-message
So when we do the task.upload() we are getting the following Stack Trace:
SEVERE: Exception during large attachment upload for 'document (1).pdf'. Error: No Response Received for upload.
[INFO] GCLOUD: com.microsoft.kiota.ApiException: No Response Received for upload.
[INFO] GCLOUD: at com.microsoft.graph.core.requests.upload.UploadResponseHandler.handleResponse(UploadResponseHandler.java:71)
[INFO] GCLOUD: at com.microsoft.graph.core.requests.upload.UploadSliceRequestBuilder.put(UploadSliceRequestBuilder.java:69)
[INFO] GCLOUD: at com.microsoft.graph.core.tasks.LargeFileUploadTask.uploadSlice(LargeFileUploadTask.java:210)
[INFO] GCLOUD: at com.microsoft.graph.core.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:134)
[INFO] GCLOUD: at plenion.officeware.services.OutlookMailService.addAttachmentsToDraft(OutlookMailService.java:1472)
Our code looks like this:
CreateUploadSessionPostRequestBody req = new CreateUploadSessionPostRequestBody();
AttachmentItem item = new AttachmentItem();
item.setAttachmentType(AttachmentType.File);
item.setName(name);
item.setSize(size);
item.setIsInline(isInline);
if (contentType != null) item.setContentType(contentType);
req.setAttachmentItem(item);
UploadSession session = graphClient
.users()
.byUserId(userMail)
.messages()
.byMessageId(draftMessageId)
.attachments()
.createUploadSession()
.post(req);
InputStream in = graphClient
.drives()
.byDriveId(driveId)
.items()
.byDriveItemId(a.getId())
.content()
.get();
try (in) {
log.info("Starting upload for attachment: " + name);
log.info("Upload session URL: " + session.getUploadUrl());
log.info("Upload session expiration: " + session.getExpirationDateTime());
int maxChunkSize = 4 * 1024 * 1024; // 4 MiB
LargeFileUploadTask<FileAttachment> task = new LargeFileUploadTask<>(
graphClient.getRequestAdapter(),
session,
in,
size,
maxChunkSize,
FileAttachment::createFromDiscriminatorValue
);
IProgressCallback callback = (current, max) -> log.info(
String.format("Uploaded %d bytes of %d total bytes", current, max)
);
UploadResult<FileAttachment> uploadResult = task.upload(5, callback);
if (uploadResult.isUploadSuccessful()) {
log.info("Upload complete. Item ID: " + uploadResult.itemResponse.getId());
} else {
log.severe("Upload failed. No response received.");
}
} catch (Exception e) {
log.severe("Exception during large attachment upload for '" + name + "'. Error: " + e.getMessage());
e.printStackTrace();
throw new RuntimeException(e);
}
If this information is useful also we are using Google App Egine Standard to host our APIs but this error also occurs while localhost development too, so at first instance this is not related with Google.
What is wrong here? Is It normal to get that message? Are we missing something?
We can provide more information if needed, please just let us know and we will update the issue. Thank you in advance.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Microsoft Graph 的大型檔案上傳文件和回報的堆疊追蹤開始,特別檢查 UploadResponseHandler.java:71、UploadSliceRequestBuilder.java:69 和 LargeFileUploadTask.java:210。使用提供的 Java 21 程式碼重現失敗,並檢查上傳回應或要求的行為。完成的標準是確認責任在 SDK 還是要求,並記錄已確認的解決方案。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100