Homepage    |    GitHub    |    API    |    FAQ

I can't sync! Please help!

  • Version: Joplin 1.2.6 (prod, darwin)
  • ErrorMsg: Error: The provided drive id appears to be malformed, or does not represent a valid drive.

image

I don't know why and it seams I can't re-link my onedrive, even thought I tried to change the sync settings.

I think it has something to do with spaces in the OneDrive path or drive ID. Maybe try to delete the whole /Apps directory on OneDrive and try again.

After I delete the whole directory in Onedrive, I still encounter the same problem. I'll try to delete the app and reinstall it.

Log

2020-12-16 10:44:33: "CommandService::execute:", "synchronize", "[false]"
2020-12-16 10:44:34: "Could not acquire synchroniser:"
2020-12-16 10:44:34: "Error: The provided drive id appears to be malformed, or does not represent a valid drive.
Code: invalidRequest
Header: {"_headers":{"cache-control":["private"],"content-type":["application/json"],"request-id":["24f73de2-59b6-4476-8086-454b81606bc6"],"client-request-id":["24f73de2-59b6-4476-8086-454b81606bc6"],"x-ms-ags-diagnostic":["{\"ServerInfo\":{\"DataCenter\":\"East Asia\",\"Slice\":\"SliceC\",\"Ring\":\"4\",\"ScaleUnit\":\"001\",\"RoleInstance\":\"AGSFE_IN_1\"}}"],"strict-transport-security":["max-age=31536000"],"date":["Wed, 16 Dec 2020 02:44:34 GMT"],"connection":["close"],"content-length":["351"]}}
Request: GET https://graph.microsoft.com/v1.0/me/drives/9695bd905361ab58/special/approot null null {"headers":{"Authorization":"bearer ey********************wb
Error: The provided drive id appears to be malformed, or does not represent a valid drive.
    at OneDriveApi.oneDriveErrorResponseToError (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/onedrive-api.js:130:19)
    at OneDriveApi.exec (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/onedrive-api.js:276:24)
    at async OneDriveApi.execJson (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/onedrive-api.js:346:20)
    at async OneDriveApi.appDirectory (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/onedrive-api.js:79:13)
    at async SyncTargetOneDrive.initFileApi (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/SyncTargetOneDrive.js:94:18)
    at async SyncTargetOneDrive.fileApi (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/BaseSyncTarget.js:70:19)
    at async SyncTargetOneDrive.initSynchronizer (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/SyncTargetOneDrive.js:104:39)
    at async SyncTargetOneDrive.synchronizer (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/@joplin/lib/BaseSyncTarget.js:106:26)"

Hi Edwardlin,

I think your problem is a Bug in Joplin. I am very motivated to fix this because I think I have introduced this Bug when adding support for onedrive for Business (I think that because before that Joplin didn't use the driveID). But unfortunately it is very difficult to fix it as I can't reproduce this. I am pretty sure that this is not related to a white space in the drive ID or the OneDrive path as Laurent noted because in this case the white space should be shown in the log and it would return an other error.

So basically I need more information. It would be very helpful when you can do the following:

  1. Get your account information from Microsft Graph api:
    1.1 open Microsoft Graph Viewer.
    1.2 Sign in with your onedrive account:
    image
    Clicking on the button will open a new popup window where you need to enter your username/password. If you see this:
    image
    you need to allow pop-up windows by clicking on the following icon in the address bar:

    1.3. Add /drive to the link in the textbox and click on 'Run query'

    1.4 Copy the text shown in the "response preivew" and paste it to the forum. I expect that it look similar to this one (but it could also show an error as your drive is obviously different to mine. You can also delete your name if you don't want to share it):
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
    "id": "dc457103bff8ccb6",
    "driveType": "personal",
    "owner": {
        "user": {
            "displayName": "Jonathan Heard",
            "id": "dc457103bff8ccb6"
        }
    },
    "quota": {
        "deleted": 1033330455,
        "remaining": 5186545423,
        "state": "normal",
        "total": 5368709120,
        "used": 182163697,
        "storagePlanInformation": {
            "upgradeAvailable": true
        }
    }
}
  1. Get your Account information saved in the joplin DB (it would be advantageous to have this information but if you don't have time or problems to do this, feel free to skip it as the account information shown in the microsoft graph view are most likely more important for the Bug fix) :
    2.1 Download and Install the SQLiteBrowser and open the database.sqlite file (on Windows it is in: C:\Users\<username>\.config\joplin-desktop on Linux in $HOME/.config/joplin-desktop ) with the SQLiteBrowser
    2.2 Open The Execute SQL Tab, paste the following command in the textbox: SELECT value FROM settings WHERE key = 'sync.3.context' and click on the execute symbol and finally copy the value to the forum:

The value should look something like:

{"accountProperties":{"accountType":"personal","driveId":"dc457103bff8ccb6"},"delta":{"nextLink":"https://graph.microsoft.com/v1.0/drive/root:/Apps/JoplinDev:/delta?select=name%2cfile%2cfolder%2cfileSystemInfo%2cparentReference%2cdeleted&token=aTE09NjM3NDM3MDE3ODM0Mzc7SUQ9REM0NTcxMDNCRkY4Q0NCNiEyNTYzO0xSPTYzNzQzNzAxNzg1NTkzO0VQPTIwO1NJPTg7RExFUD0wO1NHPTE7U089MjtQST0z"}}

Note for myself (developers willing to fix that)

If Edwardlin is using a Onedrive Personal Account, a dirty fix would be to change the request for getting the App Directory for personal accounts back to the method used before adding support for OneDrive for Business


But this would only work for personal accounts. So I would prefer to fix it properly.

2 Likes

Thanks for your elaborated explain. And I have tried what you said.

After I send the request as you said at 1.3


But I didn't get the response you expected. Instead, I got 401 and the response is

{
    "error": {
        "code": "unauthenticated",
        "message": "Must be authenticated to use '/drive' syntax.",
        "innerError": {
            "date": "2020-12-16T14:32:32",
            "request-id": "72296ca3-bb5d-44e0-bfb6*****c416992",
            "client-request-id": "e17bf025-2d8f-070d-8dd7-****c4e56d6c"
        }
    }
}

This is very interesting. In that case it seems to be a Microsoft Problem and similiar to this. I will add your information to the case tomorrow and hopefully we get some information from Microsoft. But can you tell us if you use an OneDrive personal or OneDrive Business (or school Account which is technically the same) Account?

I opened now an Issue on Github for this: https://github.com/OneDrive/onedrive-api-docs/issues/1416
Let's hope Microsoft answers the question.

1 Like

Thanks, and I switch to Google Drive and sync through the file system

Hi,
I meet the same problem recently, it was working fine previously, but after i change the authentication method to " two - step verification" of the Microsoft account, this problem happens.