Opened 6 weeks ago

Closed 2 hours ago

#15337 closed defect (fixed)

CLOUD: OneDrive storage doesn't work at all

Reported by: dwatteau Owned by: Tkachov
Priority: blocker Component: Cloud
Version: Keywords: onedrive
Cc: Game:

Description

This is with either the stable 2.8.x releases, or the current 2.9.0git HEAD, on various devices.

Trying to set up a OneDrive account from scratch in the Cloud tab (with the documented process) always results in a "Saved games sync failed.
Check your Internet connection", although the backend _is_ connected to OneDrive.

The logs don't tell much about what is going on, but running with -d9 gives the following information:

NetworkReadStream: https://graph.microsoft.com/v1.0/drive/special/approot:/saves:/children - Request succeeded
OneDriveTokenRefresher: code = 404
OneDriveTokenRefresher: code = itemNotFound
OneDriveTokenRefresher: message = The resource could not be found.
<irrecoverable> {
  "error":{
    "code":"itemNotFound","innerError":{
      "client-request-id":"XXX-some-uuid-XXX","date":"2024-08-23T12:16:42","request-id":"XXX-some-uuid-XXX"
    },"message":"The resource could not be found."
  }
}
SavesSync::finishError
Storage: error response (failed, 404):
<irrecoverable> {
  "error":{
    "code":"itemNotFound","innerError":{
      "client-request-id":"XXX-some-uuid-XXX","date":"2024-08-23T12:16:42","request-id":"XXX-some-uuid-XXX"
    },"message":"The resource could not be found."
  }
}

Looking a bit at <https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/special-folders-appfolder?view=odsp-graph-online>, I can't say whether we have proper support for the Files.ReadWrite.AppFolder permission scope that the OneDrive API now appears to require?

I'm making this a blocker, because it looks like current users of the stable releases possibly can't access their ScummVM OneDrive data (saves, settings, games…) anymore, because of this?

Change History (2)

comment:1 by Tkachov, 24 hours ago

We seem to request Files.ReadWrite.AppFolder permission (I think it was always required and we do that since original implementation): https://github.com/scummvm/scummvm-sites/blob/cloud/src/routes.php#L54

This specific log says that "saves" subdirectory wasn't found. Maybe that fact was communicated differently before? Guess I'd need to do some testing and handle this situation by creating such subdirectory (or return empty array as result of listing it).

comment:2 by Tkachov, 2 hours ago

Owner: set to Tkachov
Resolution: fixed
Status: newclosed

In 9dd3a676:

CLOUD: fix #15337

Fixes OneDrive sync by handling list of unexisting "saves" subdirectory.

Previously, code that worked with JSON didn't trigger, because string was intentionally malformed. If it wasn't, OneDriveTokenRefresher::finishError() would've treated it as JSON parse failure, tried to fix it, and call finishJson() instead of finishError().

Note: See TracTickets for help on using tickets.