microsoftgraph / microsoftgraph/msgraph-sdk-java

LargeFileUploadTask Upload session failed.

Abierto
#2,332 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

status:waiting-for-triage type:bug
Lenguaje dominante
Java
Estrellas
444
Forks
154
Merge medio
18 h 28 min
PR fusionados (30 d)
4

Descripción

Describe the bug

For large file uploads using com.microsoft.graph:microsoft-graph:5.80.0, it always prompts: com.microsoft.graph.core.ClientException: Upload session failed. Below is the full log

`DriveUpload DriveUpload
com.microsoft.graph.core.ClientException: Error while executing the request
at com.microsoft.graph.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:260)
at com.geniatech.onedrive.DriveUpload.uploadFile(DriveUpload.java:119)
at com.geniatech.onedrive.DriveUpload.run(DriveUpload.java:45)
Caused by: java.util.concurrent.ExecutionException: com.microsoft.graph.core.ClientException: Upload session failed.
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:359)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1921)
at com.microsoft.graph.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:255)
at com.geniatech.onedrive.DriveUpload.uploadFile(DriveUpload.java:119) 
at com.geniatech.onedrive.DriveUpload.run(DriveUpload.java:45) 
Caused by: com.microsoft.graph.core.ClientException: Upload session failed.
at com.microsoft.graph.tasks.LargeFileUploadRequest.upload(LargeFileUploadRequest.java:107)
at com.microsoft.graph.tasks.LargeFileUploadTask.uploadAsync(LargeFileUploadTask.java:167)
at com.microsoft.graph.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:255) 
at com.geniatech.onedrive.DriveUpload.uploadFile(DriveUpload.java:119) 
at com.geniatech.onedrive.DriveUpload.run(DriveUpload.java:45) 
Caused by: com.microsoft.graph.core.ClientException: Error code: unauthenticated
Error message: Unauthenticated

                                                                                                PUT https://my.microsoftpersonalcontent.com/personal/2fdc61d53bdc14dc/_api/v2.0/drive/items/016254SOI4F63FDODDGFD2HROPQGFCQN4Y/uploadSession?guid=%271be67694-c6e8-490b-bb91-5928bb3e34a8%27&overwrite=True&rename=False&dc=0&tempauth=v1e.eyJzaXRlaWQiOiIxMGEzZDNiMy0wZjYxLTRjZGItOWU3OC02OTcxMTlhMjIwMzQiLCJhcHBfZGlzcGxheW5hbWUiOiJHcmFwaCIsImFwcGlkIjoiMTA3YjJiMzEtMTgyYi00NWQzLTg0MjMtODJiNDRmYThkOTdmIiwiYXVkIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL215Lm1pY3Jvc29mdHBlcnNvbmFsY29udGVudC5jb21AOTE4ODA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkIiwiZXhwIjoiMTc0MTkyNDkxMSJ9.MnNt1k9jB4BFWdYtXXI_XiAHUKX9RR5uC3afHu0CMEvvtEMOiRWVbO6lQqm_efwW2tGgZmwY4Pgjxr1OErnINH6iyZiZDitnYuJOXUncig4N43UCoTUnv76Qaq9LdccPaa4fR-4svB3ljphSJjfO-r7aBLogUfRm2qDFNhcChSbMVg1ljwMrrKCAUz50Dk8MKMCijkr5Af_9incN6Gevsg6Jg2yO_thDpE0P3rYCQd0Pom5AGbmXUel2y0dEoBNJlckCjGD7x0RZe6bVLU2-S7cJGIJmuqlL2WvopHaXGMkIx4fi8f9HW2UbBRb1OL_qcjywIrzOJxFtdiRWusWwGr_FKMkNYPCZeWLqZZDPbAcW_7C4kmDu61PQzIsDENzA0m9DXnS6zSCuBdV7wd_r8ZQfNlhPp6has8IcNH1_XC3sMKrmIlOWFsy8g4jrYm1h7xnS6-87FoMiYMhc3VwQQA.PLtp6iHBMdJ7GperLV5mVeBcj_X_x4bl7eYCXFu4R9U
                                                                                                SdkVersion : graph-java/v5.80.0
                                                                                                Content-Range : bytes 0-1652626/1652627
                                                                                                
                                                                                                
                                                                                                401 : 
                                                                                                [...]
                                                                                                
                                                                                                [Some information was truncated for brevity, enable debug logging for more details]
                                                                                                	at com.microsoft.graph.tasks.LargeFileUploadResponse.<init>(LargeFileUploadResponse.java:95)
                                                                                                	at com.microsoft.graph.tasks.LargeFileUploadResponseHandler.generateResult(LargeFileUploadResponseHandler.java:95)
                                                                                                	at com.microsoft.graph.tasks.LargeFileUploadResponseHandler.generateResult(LargeFileUploadResponseHandler.java:55)
                                                                                                	at com.microsoft.graph.http.CoreHttpProvider.processResponse(CoreHttpProvider.java:435)
                                                                                                	at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:408)
                                                                                                	at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
                                                                                                	at com.microsoft.graph.tasks.LargeFileUploadRequest.upload(LargeFileUploadRequest.java:98)
                                                                                                	... 4 more
                                                                                                Caused by: com.microsoft.graph.http.GraphServiceException: Error code: unauthenticated
                                                                                                Error message: Unauthenticated

2025-03-13 12:02:02.899 26905-27095 Netdisk com.geniatech.knote.netdisc E PUT https://my.microsoftpersonalcontent.com/personal/2fdc61d53bdc14dc/_api/v2.0/drive/items/016254SOI4F63FDODDGFD2HROPQGFCQN4Y/uploadSession?guid=%271be67694-c6e8-490b-bb91-5928bb3e34a8%27&overwrite=True&rename=False&dc=0&tempauth=v1e.eyJzaXRlaWQiOiIxMGEzZDNiMy0wZjYxLTRjZGItOWU3OC02OTcxMTlhMjIwMzQiLCJhcHBfZGlzcGxheW5hbWUiOiJHcmFwaCIsImFwcGlkIjoiMTA3YjJiMzEtMTgyYi00NWQzLTg0MjMtODJiNDRmYThkOTdmIiwiYXVkIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL215Lm1pY3Jvc29mdHBlcnNvbmFsY29udGVudC5jb21AOTE4ODA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkIiwiZXhwIjoiMTc0MTkyNDkxMSJ9.MnNt1k9jB4BFWdYtXXI_XiAHUKX9RR5uC3afHu0CMEvvtEMOiRWVbO6lQqm_efwW2tGgZmwY4Pgjxr1OErnINH6iyZiZDitnYuJOXUncig4N43UCoTUnv76Qaq9LdccPaa4fR-4svB3ljphSJjfO-r7aBLogUfRm2qDFNhcChSbMVg1ljwMrrKCAUz50Dk8MKMCijkr5Af_9incN6Gevsg6Jg2yO_thDpE0P3rYCQd0Pom5AGbmXUel2y0dEoBNJlckCjGD7x0RZe6bVLU2-S7cJGIJmuqlL2WvopHaXGMkIx4fi8f9HW2UbBRb1OL_qcjywIrzOJxFtdiRWusWwGr_FKMkNYPCZeWLqZZDPbAcW_7C4kmDu61PQzIsDENzA0m9DXnS6zSCuBdV7wd_r8ZQfNlhPp6has8IcNH1_XC3sMKrmIlOWFsy8g4jrYm1h7xnS6-87FoMiYMhc3VwQQA.PLtp6iHBMdJ7GperLV5mVeBcj_X_x4bl7eYCXFu4R9U
SdkVersion : graph-java/v5.80.0
Content-Range : bytes 0-1652626/1652627

                                                                                                401 : 
                                                                                                [...]
                                                                                                
                                                                                                [Some information was truncated for brevity, enable debug logging for more details]
                                                                                                	... 10 more`
Expected behavior

Creating files and downloading files are normal, uploading files is not clear why it is abnormal, it was still normal last year

How to reproduce

`private void uploadFile() throws Exception {
// Get an input stream for the file
File file = new File(filepath);
String itemPath = "/" + type.getFolderName() + "/" + file.getName();
LogUtils.i(TAG, "itemPath=" + itemPath + ";type=" + type);
InputStream fileStream = Files.newInputStream(file.toPath());
long streamSize = file.length();

    // Create a callback used by the upload provider
    // Called after each slice of the file is uploaded
    IProgressCallback callback = (current, max) -> {
        int progress = (int) (current * 100 / max);
        listener.onMessage(true, progress);
        LogUtils.i(TAG, "current=" + current + ";max=" + max + ";progress=" + progress);

        try {
            if (isInterrupted()) {
                LogUtils.i(TAG, "fileStream.close=");
                fileStream.close();
            }
        } catch (IOException e) {
            LogUtils.e(TAG, "uploadFile", e);
        }
    };

    DriveItemCreateUploadSessionParameterSet uploadParams = DriveItemCreateUploadSessionParameterSet.newBuilder()
            .withItem(new DriveItemUploadableProperties()).build();

    // Create an upload session
    UploadSession uploadSession = getGraphServiceClient(token)
            .me()
            .drive()
            .root()
            // itemPath like "/Folder/file.txt"
            // does not need to be a path to an existing item
            .itemWithPath(itemPath)
            .createUploadSession(uploadParams)
            .buildRequest()
            .post();

    LargeFileUploadTask<DriveItem> largeFileUploadTask = new LargeFileUploadTask<>(uploadSession, getGraphServiceClient(token), fileStream, streamSize, DriveItem.class);
    // Do the upload
    largeFileUploadTask.upload(0, null, callback);
}`
SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo del ejemplo de uploadFile() y, después, sigue la solicitud a través de LargeFileUploadTask.upload y LargeFileUploadRequest.upload. Compara la solicitud de la sesión de carga y su respuesta 401 con la versión del SDK mostrada en el informe; se considera completado cuando las cargas de archivos grandes finalizan correctamente en lugar de devolver "Unauthenticated".

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
28/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.