microsoftgraph / microsoftgraph/msgraph-sdk-java

Getting: "No Response Received for upload." exception using LargeFileUploadTask

オープン
#2,500 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

status:waiting-for-triage
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。