Joplin: Cannot synchronization on onedrive

Created on 30 Jan 2020  路  19Comments  路  Source: laurent22/joplin

I have two PC that was installed Joplin and logged-in with the same onedrive account to synchronization. But when I upgrade Joplin from 1.0.175 to 1.0.178 or 1.0.179, all notes was not to be sync and display this error on my second PC when I press synchronization.

Error: Not a valid URL: https://graph.microsoft.com/v1.0/drive/root:/%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F/Joplin 1/.sync?select=name%2Cfile%2Cfolder%2CfileSystemInfo%2CparentReference

backlog bug desktop

All 19 comments

I confirm this bug. I don't receive any errors. The synchronisation button from bottom left or from menu or synchronisation keys don't work.

I have this bug too. Sync button via onedrive does not work. Both on my Fedora machine as well on android.

@wawacorp you should have some settings problem. This bug affects only PC software version (and maybe Linux). On my Android everything works fine.

@mugoro I have similar problem on my android app as well.
Changed is sync to File system to sync to my phone storage, and the button works again.
What I noticed is the sync start failing when on the dektop app, the authentication of Onedrive gives u a localhost link instead the open up login of outlook.com.

The only way to fix this was to take a clean copy of Joplin v1.0.179 (I work with portable versions). Start making the synchronization settings with Onedrive. Start the synchronization (do not enable encryption until you will be asked for). This will work smooth if your last savings are on Onedrive and not locally. Anyway, if you have many local documents (unsynchronized), before installing a clean Joplin, you may export them and afterwards import them back in the new clean Joplin installation.

I had a similar bug. It went like this:

  1. Install Joplin for the first time.
  2. Add two new notes.
  3. Set synchronization setting to OneDrive.
  4. When first trying to synchronize, authorize it to access my OneDrive, and complete that process.
  5. Try to synchronize again and nothing happens. Repeat using menu item/button/hotkey, nothing has any effect. Synchronization status screen says nothing synchronized.
  6. Set synchronization setting to DropBox instead.
  7. When first trying to synchronize, authorize it to access my Dropbox, and complete that process.
  8. Try to synchronize and it works fine the first time.

I would prefer to use OneDrive if possible, because I have more space there through my employer, but I'm using DropBox for now until this bug is resolved.

I'm having sync errors on onedrive too. Luckly i have restored everything from a backup but i'm still having sync problems.

I am also experiencing issues with syncing on OneDrive. When I try to sync the app it will sync only few dozens of items and then it stops with "Last error: Error".

I get the same result as @alexdevero, i.e. a few notes get synced (anywhere from none to several dozen) and the operation ends with the same error message (Win10, Joplin 1.0.195 and Onedrive)

In case it's helpful, here's the the last entry in the log.txt file:

2020-03-29 15:38:28: "Operations completed: "
2020-03-29 15:38:28: "createRemote: 11"
2020-03-29 15:38:28: "Total folders: 2"
2020-03-29 15:38:28: "Total notes: 7465"
2020-03-29 15:38:28: "Total resources: 5502"
2020-03-29 15:38:28: "There was some errors:"
2020-03-29 15:38:28: "Error
Code: UnknownError
Header: {"_headers":{"cache-control":["private"],"content-type":["application/json"],"request-id":["59436e1b-7bdf-4231-a27e-cd5707290c2c"],"client-request-id":["59436e1b-7bdf-4231-a27e-cd5707290c2c"],"x-ms-ags-diagnostic":["{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"SliceC\",\"Ring\":\"5\",\"ScaleUnit\":\"003\",\"RoleInstance\":\"AGSFE_IN_99\"}}"],"strict-transport-security":["max-age=31536000"],"date":["Sun, 29 Mar 2020 13:38:29 GMT"],"connection":["close"],"content-length":["198"]}}
Request: GET https://graph.microsoft.com/v1.0/drive/root:/Apps/Joplin/d8eaab31f61446e0acdcd6cd9bb5d7d1.md?select=name%2Cfile%2Cfolder%2CfileSystemInfo%2CparentReference {"select":"name,file,folder,fileSystemInfo,parentReference"} null {"headers":{"Authorization":"bearer EwBwA8l6BAAUO9chh8cJscQLmU+LSWpbnr0vmwwAATTnumxrAkOY9vai124Bp/Jufp+m7JqQn3rO91zOn/SySqatjD1YYZnt6j/PpAu+F6IBI97uQrnXWKqmGrEHmBvlxflourHYqUST0yo6VFW8SU4zaDfhgkWsa4gc5QYICLxguE4rO5JgOKGalckuqCQX3RKIJD2q7xxzCfbdvmD0ZpcYl9tB700KPKfLNKmZ/YDMc+V/XCU0ykj0HI84QL/38Z9XlrJUConf3aaGH7iUAdpnbFkGJHa7rwaxLRcqFYGLYynjEGsKKuKxUnH0Eb68gRx2h7SATi33VhI6WhuiK0SwbBID+pRt7+t5t/viSadhqw+Z/hM7WfKsQFeWlx0DZgAACDRIZ/dm7j1UQAKRq+cvNgI4ZFMbgZhd4XoZtzAYU/l8Styew8OGGefuDwRK+uoUT7oatCOSgApL7KT4sQeRoYAdgd4j0hEG0jPcs5LSWdY0KokWSceUpHiFekqBy9znmmbmEiq7N+lpmn1cNzeFEm4fhM3fXR0H2Q8xtGUMjogMwgU/A/mfqijl/4VF5qhHeXEyp0QggocllDdzth454B+YxFMWcIBMg0h+mY9Oy8EZTq1CZYt5xFXPd8EG+GwvlDfp7JNvf7My9TjhBjQKSIM6WQWSO+6IFS6U2515Y52OKDXYFT+7l9zNkC5bKggnv6vr+s8LEmLoFnlzjv1DJ2PFl59LSnK25Sit7ZaU2+8yXas6l7wrDB
Error
    at OneDriveApi.oneDriveErrorResponseToError (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\onedrive-api.js:124:19)
    at OneDriveApi.exec (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\onedrive-api.js:195:24)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async OneDriveApi.execJson (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\onedrive-api.js:249:20)
    at async FileApiDriverOneDrive.statRaw_ (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\file-api-driver-onedrive.js:51:11)
    at async FileApiDriverOneDrive.stat (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\file-api-driver-onedrive.js:60:16)
    at async tryAndRepeat (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\file-api.js:37:19)
    at async FileApi.stat (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\file-api.js:162:18)
    at async Synchronizer.start (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\synchronizer.js:366:22)
    at async timeoutCallback (C:\Users\Kjell\AppData\Local\Programs\Joplin\resources\app.asar\lib\registry.js:131:26)"

I've had similar issues syncing with OneDrive, however, I believe my problems are related to using multiple OneDrive accounts simultaneously (work/personal).
Forcing a token refresh works for me.

MacOS (Joplin 1.0.197):

sqlite3 $HOME/.config/joplin-desktop/database.sqlite "DELETE FROM settings WHERE key IS 'sync.3.auth';"

You should be prompted to re-auth the next time you attempt to synchronize.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

Hi,
I have the same issue.

I tried with the solution proposed by @goldeelox , but it doesn't work in my case.

Error: Access denied at OneDriveApi.oneDriveErrorResponseToError (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:124:19) at OneDriveApi.exec (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:195:24) at async OneDriveApi.execJson (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:249:20) at async OneDriveApi.appDirectory (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:76:13) at async SyncTargetOneDrive.initFileApi (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/SyncTargetOneDrive.js:74:18) at async SyncTargetOneDrive.fileApi (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/BaseSyncTarget.js:73:19) at async SyncTargetOneDrive.initSynchronizer (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/SyncTargetOneDrive.js:83:38) at async SyncTargetOneDrive.synchronizer (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/BaseSyncTarget.js:109:26) at async timeoutCallback (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/registry.js:108:19)"

Same issue here, as well. "Synchronize" button did nothing when I clicked it with "OneDrive" selected as sync destination.

I was able to fix it. I think @goldeelox is right that this is due to being signed in to multiple accounts at once. I was also signed in to my work account.

Here's what I did to fix it:

  1. Cleared out all cookies related to Microsoft. login.microsoftonline.com was the last one I cleared, but I'm not sure if that was sufficient or just necessary. Others include *.live.com and account.microsoft.com.
  2. Exited Joplin.
  3. Executed the command that @goldeelox suggested to clear out the auth credentials: sqlite3 $HOME/.config/joplin-desktop/database.sqlite "DELETE FROM settings WHERE key IS 'sync.3.auth';"
  4. Started Joplin and clicked "Synchronize". Seems to be working now :D

Hi,
I have the same issue.

I tried with the solution proposed by @goldeelox , but it doesn't work in my case.

Error: Access denied at OneDriveApi.oneDriveErrorResponseToError (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:124:19) at OneDriveApi.exec (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:195:24) at async OneDriveApi.execJson (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:249:20) at async OneDriveApi.appDirectory (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/onedrive-api.js:76:13) at async SyncTargetOneDrive.initFileApi (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/SyncTargetOneDrive.js:74:18) at async SyncTargetOneDrive.fileApi (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/BaseSyncTarget.js:73:19) at async SyncTargetOneDrive.initSynchronizer (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/SyncTargetOneDrive.js:83:38) at async SyncTargetOneDrive.synchronizer (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/BaseSyncTarget.js:109:26) at async timeoutCallback (/tmp/.mount_JoplinC0y7aX/resources/app.asar/lib/registry.js:108:19)"

Received same issue. Ended up using Dropbox instead.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

The issue is still present for me

I'm having this same issue as well. I've authenticated with OneDrive but syncronization doesn't work at all in the desktop app. Mobile app seems to be working fine however.

I think I got something. The issue because there is an unescaped space between "Joplin" and "1" in the error URL.

https://github.com/laurent22/joplin/blob/656615b571798bff37e7bf8bf50c61c533c010ea/ReactNativeClient/lib/onedrive-api.js#L76-L80

The path is fetched by calling the captured code above. At some point after authorisation, Microsoft OneDrive API return a new application name, suffixing a space and number 1 to the name. so the {r.name} contain the unescaped space.

I think this issue should be solved by only escaping the name from API call. In my opinion, Joplin could define and manage its own folder structure on OneDrive, instead of just relying the structure provided by OneDrive. The API could change the path without any notice (just like what happening in this case). Even extra privileges are needed, I would authorise it as a trade off to minimise the impact from Microsoft.

There are some thing you could try to fix the issue:

  1. remove the space folder name manually in OneDrive. However after I removed the space, Joplin still can't sync, stated 'Error: Item does not found'. I think the error is from OneDrive too, but I really have no suitable tool to continue on this path. Worth a try, but not promising.

  2. Destructive Method! Make sure you backup manually with other method first!
    2.1 Delete all the folder related to JoplinI. If you are in the same situation as me, you should have the original 'Joplin' and 'Joplin 1'. Delete both. Again, make sure you backed up before delete! Only renaming the 'Joplin 1' wont work. (as least didn't work for me).
    2.2 revoke app access from OneDrive side. go to https://account.live.com/consent/Manage, then find Joplin, click on it and revoke on next page.
    2.3 Remove authorisation token from Joplin client side. @goldeelox provide a command on Mac, but other platform should be similar by running the delete SQL to the SQLite db file. DELETE FROM settings WHERE key IS 'sync.3.auth';
    2.4 Restart Joplin, try to sync with OneDrive again.

The second method is essentially making a full resync. But if you are desperate, and don't want to change to other sync solution (for me, I changed to Dropbox because I have had enough with too many error with OneDrive), that might be the way to go.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings