openmobilehub / android-omh-storage

https://www.openmobilehub.org
Apache License 2.0
4 stars 1 forks source link

Error: `generalException` when uploading files to OneDrive #48

Closed dzuluaga closed 2 months ago

dzuluaga commented 3 months ago

Natalia and Maciek,

URGENT: FOR TODAY'S WEBINAR DEMO .

When attempting to upload files to OneDrive using the Open Mobile Hub Android storage plugin, the following error occurs: generalException.

Steps to Reproduce:

  1. Open the Open Mobile Hub app.
  2. Navigate to the File Viewer.
  3. Attempt to upload a file to OneDrive.
  4. Observe the error message.

Expected Behavior: The file should be uploaded successfully without any errors.

Actual Behavior: A pop-up appears with the message "Something went wrong. Error detail: generalException."

Error Log:

2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W  com.microsoft.kiota.ApiException: generalException
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.microsoft.kiota.ApiExceptionBuilder.withMessage(ApiExceptionBuilder.java:45)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.microsoft.graph.core.requests.upload.UploadResponseHandler.handleResponse(UploadResponseHandler.java:76)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.microsoft.graph.core.requests.upload.UploadSliceRequestBuilder.put(UploadSliceRequestBuilder.java:69)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.microsoft.graph.core.tasks.LargeFileUploadTask.uploadSlice(LargeFileUploadTask.java:204)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.microsoft.graph.core.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:128)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.openmobilehub.android.storage.plugin.onedrive.data.service.OneDriveApiClient.uploadFile$plugin_onedrive_debug(OneDriveApiClient.kt:65)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.openmobilehub.android.storage.plugin.onedrive.data.service.OneDriveApiService.uploadFile(OneDriveApiService.kt:71)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.openmobilehub.android.storage.plugin.onedrive.data.repository.OneDriveFileRepository.uploadFile(OneDriveFileRepository.kt:49)
2024-07-17 00:30:34.992 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.openmobilehub.android.storage.plugin.onedrive.OneDriveOmhStorageClient.uploadFile(OneDriveOmhStorageClient.kt:92)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at com.openmobilehub.android.storage.sample.presentation.file_viewer.FileViewerViewModel$uploadFile$1.invokeSuspend(FileViewerViewModel.kt:315)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
2024-07-17 00:30:34.993 19935-32001 System.err              com.openmobilehub.android.storage.sample  W     at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Environment:

Additional Context: This error seems to occur consistently and prevents file uploads to OneDrive.

Screenshots: Screenshot_20240717_002534_com openmobilehub android storage sample

CC - @itsme291 @prestonlau

maciekBudzinski commented 3 months ago

Hi Diego, thank you for reporting the issue. I was try to reproduce the issue that you have but with no luck. Can you please provide some more details on the file that you try to upload? If possible, please upload the file in this thread so we can try to reproduce it. Could you also please try to see it works with the latest build?

maciekBudzinski commented 3 months ago

The latest release build

dzuluaga commented 3 months ago

Thanks for the quick response Maciek. We're experiencing the same error with your apk. Also @kubaluberadzki was able to repro in a Pixel device.

dzuluaga commented 3 months ago

From @DamianNowak5f as I don't see your reply in this thread.

The error that Kuba was experiencing was a bit of a different nature - already addressed in the latest build.

Regarding this upload error, we can only reproduce it using the openmobilehubtest@outlook.com test account. Could you confirm that this is the account you were using? Could you check any other accounts? This will help us pinpoint the issue.

Thanks @DamianNowak5f . Understood. However, I encountered the same error that Kuba ran into during our last call, even when using my personal account instead of openmobilehubtest@outlook.com. I've noticed this issue intermittently in the past as well. I wonder if it might be related to this recurring error. Given this, I believe it’s worth a deeper investigation since the app appears to be quite brittle. I doubt the issue resides on the Microsoft account side, as these services are used by millions of users without similar problems. Could you please look into it?

Screenshot_20240719_064632_com openmobilehub android storage sample

damiann5f commented 3 months ago

Thanks for the update. We are working on both issues. I believe they might not have to be connected, so I am addressing them separately:

I will take it from there and update you once we have fixes.

dzuluaga commented 3 months ago

Thank you, Damian. Please keep us posted.

damiann5f commented 3 months ago

Hi, and updated regarding the issues:

dzuluaga commented 3 months ago

Thanks, Damian. Can you elaborate on what the issue was? Also, please include the patch in the comments. Thx!

damiann5f commented 3 months ago

Sure: the OneDrive implementation was not always using the latest access token and did not refresh once cached values - more details in this PR.

dzuluaga commented 3 months ago

Thanks, Damian. The PR is titled with OneDrive, is there a reason why other providers' files (Dropbox, Google) are modified as well?

damiann5f commented 3 months ago

The issue with possibly not using the latest access token was mainly visible on OneDrive, as the access token there has quite a short life span, but a similar refactor was needed for other providers.

damiann5f commented 3 months ago

Hi, we have an updated on the OneDrive upload issue.

The bug is on msgraph-sdk-java end, as we face same issues as reported here and here, and posted on Microsoft Q&A.

Those reports confirm our findings that only a subset of accounts is affected by it.

We will look for a workaround, but deprioritize it for now and observe whether the provider fixes it first.