Getting: "No Response Received for upload." exception using LargeFileUploadTask
还没有人认领这个 Issue。
评估
调研方向
从 Microsoft Graph 的大文件上传文档和报告的堆栈跟踪开始,重点查看 UploadResponseHandler.java:71、UploadSliceRequestBuilder.java:69 和 LargeFileUploadTask.java:210。使用提供的 Java 21 代码重现失败,并检查上传响应或请求的行为。完成的标准是确定责任在 SDK 还是请求,并记录已确认的解决方案。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Java
- 星标
- 444
- 派生
- 154
- 平均合并
- 18 小时 28 分钟
- 30 天内合并 PR
- 4
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoftgraph/msgraph-sdk-java 的其他 Issue
-
status:waiting-for-triage type:bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
难度 3/5 1-2 天 新手友好度 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
难度 4/5 3-5 天 新手友好度 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
status:waiting-for-triage type:bug
难度 3/5 1-2 天 新手友好度 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 条评论 ·
查看 microsoftgraph/msgraph-sdk-java 的全部 Issue
相似的 Issue
-
Bug Java Platform: Java
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-java#6138 · 1 条评论 ·
-
bug needs triage p2
难度 2/5 1-3 小时 新手友好度 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 条评论 ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/rocketmq-dashboard#4654 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100