Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video upload fails with {"error":{"code":"itemNotFound","message":"The upload session was not found"}} #7

Open
denven opened this issue Apr 23, 2023 · 2 comments
Assignees
Labels
api issue Issue related to API access, or issued caused by the API service bug Something isn't working resolved

Comments

@denven
Copy link
Owner

denven commented Apr 23, 2023

This issue hasn't happened to the consumers basic personal account before, and I am currently using an Azure Directory tenant account to upload all video files uploaded to a larger size OneDrive space.

The upload job worked perfectly since I installed the camera outside yesterday. After trying to change some settings from the mobile app, I found there were no new videos uploaded, then I checked the logs, and video files are still being generated, but each video file fails to complete the final step during uploading each fragment.

2023-04-22 18:59:52 upload chunk: 0, length: 3932160, bytes: 0-3932159
2023-04-22 19:00:11 upload chunk: 1, length: 3932160, bytes: 3932160-7864319
2023-04-22 19:00:28 upload chunk: 2, length: 3525868, bytes: 7864320-11390187
{"error":{"code":"itemNotFound","message":"The upload session was not found"}}

Rebooting or resetting this uploader sometimes worked for a short time, but it will fail into this issue again and all video files will not be uploaded successfully after a while.

@denven denven self-assigned this Apr 23, 2023
@denven denven added the bug Something isn't working label Apr 23, 2023
@denven denven changed the title Video upload fails with error {"error":{"code":"itemNotFound","message":"The upload session was not found"}} Video upload fails with {"error":{"code":"itemNotFound","message":"The upload session was not found"}} Apr 23, 2023
@denven
Copy link
Owner Author

denven commented Apr 23, 2023

found below from the official document Common error responses and codes
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/errors?view=odsp-graph-online

uploadSessionNotFound Upload session not found.

Onedrive API issue: OneDrive/onedrive-api-docs#698

@denven denven added the api issue Issue related to API access, or issued caused by the API service label Apr 23, 2023
@denven
Copy link
Owner Author

denven commented Apr 23, 2023

From the resumable API doc, it states the following:

Cancel the upload session
To cancel an upload session send a DELETE request to the upload URL. This cleans up the temporary file holding the data previously uploaded. This should be used in scenarios where the upload is aborted, for example, if the user cancels the transfer.

Temporary files and their accompanying upload session are automatically cleaned up after the expirationDateTime has passed. Temporary files may not be deleted immediately after the expiration time has elapsed.`

I have a line of code to delete the resumable upload session when video file chunks are all uploaded(the upload result may be successful or not). I guess there is a chance that the file fragments are still in processing and not merged to a file on OneDrive, and the session has already been deleted by OneDrive API, however, my request to DELETE it triggers the API issue which will abnormally delete the temporary fragments and abort merging them to a video file.

image

Then, I think there is no need to do this deletion if the fragments upload is successful, let the session be cleaned up automatically. And the deletion is needed only when upload errors are found and no more retries will be done from this session.

The fix is to move this line to the retry failed if branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api issue Issue related to API access, or issued caused by the API service bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

1 participant