Nextcloud sync mystery

Operating system

Windows

Joplin version

3.7.18

Desktop version info

3.7.18, also previous versions

Sync target

Nextcloud

Editor

Rich Text Editor

What issue do you have?

Hello!

I'm encountering a bunch of strangeness, and I'm trying to see where it's cause likely is coming from. I've also not found a reference to anybody else having this problem, which isn't encouraging to me.

So...

I've been using Joplin with sync to NextCloud hosted on Hostwinds for several years without a problem. Suddenly, about a month ago, sync started erroring out even though nothing I'm aware of had changed (no upgraded clients, no changes in usage, no upgraded server components... that I know of). I tried upgrading NextCloud, ran into an error, and rather than troubleshoot that environment, I just installed a new instance of NextCloud using a different name (i.e. nextcloud3 instead of nextcloud2). All seemed to be well with the installation, but sync continued to fail. I checked with Hostwinds, and after a long back and forth, they claim everything they can see is working correctly (they refused to test from outside their firewall, and they only tested NextCloud, not Joplin itself) - however, they, in the past, have never admitted when anything was their fault (even after the issue mysteriously resolved after my trouble ticket pointed it out), so their statements may be incomplete, at the very least.

However, I have now tested Joplin on various clients, on various devices, on various networks (even a brand-new, fresh, no-data install), and the error is now consistent:

Last error: Error: Could not upgrade from version 0 to version 1: PUT .sync/version.txt: Unknown error 2 (404):

Nextcloud https://example.com/nextcloud/remote.php/webdav/Joplin
:config sync.5.username YOUR_USERNAME
:config sync.5.password YOUR_PASSWORD
:config sync.target 5..."

Is this a new requirement, or does it happen by default - or why haven't I needed to do this in the past years?

Thank you, anybody, for any effort to get to the root of this.

Peace,
SJ

If you sync a new joplin profile without of your data to a empty folder on the server, do you still get the issue?

Also if you use a webdav client such as CarotDAV, are you able to connect to your server and read, write, overwrite and delete both files and folders on the server?

Hello!

Yes, I get the error with new profile - I even tested it with a new server-side install of NC.

I did test with NextCloud's app and it would connect there - but not sync Joplin (I believe Hostwinds tried the non-Joplin client as well).

Strange, right?

Thanks for asking!

SJ

...and yes, I was able to read/write/del on the server - I even set up the account as Admin for testing.

Are you connecting in Joplin via the NextCloud or the WebDAV option? Try using WebDAV instead if you are not already.

Also can you try using an actual WebDAV client rather than the NextCloud app?

Tried WebDav in Joplin, using the identical URL - same error. With a slight modification, it says it needs to "upgrade first", tries it, then produces the error below. Is there a trustworthy WebDav client you can recommend? Unfortunately, I suspect it's actually some piece of how Joplin is using NextCloud that is being interfered with.

Error

The sync target could not be upgraded due to an error. For support, please copy the complete content of this page and paste it in the forum: https://discourse.joplinapp.org/

The full error was:

Could not upgrade from version 1 to version 2: PUT .sync/version.txt: Unknown error 2 (404): Nextcloud <link rel="stylesheet" href="/nextcloud3/core/c

Error: Could not upgrade from version 1 to version 2: PUT .sync/version.txt: Unknown error 2 (404): <!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" translate="no" >
	<head
 data-requesttoken="">
		<meta charset="utf-8">
		<title>
			Nextcloud		</title>
		<meta name="csp-nonce" nonce="IEAwAXjlwRP99mjXboBEg+6s2GsJRYvg2waTCj6cvrY=">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
				<meta name="apple-itunes-app" content="app-id=1125420102">
				<meta name="theme-color" content="#00679e">
		<link rel="icon" href="/nextcloud3/core/img/favicon.ico">
		<link rel="apple-touch-icon" href="/nextcloud3/core/img/favicon-touch.png">
		<link rel="mask-icon" sizes="any" href="/nextcloud3/core/img/favicon-mask.svg" color="#00679e">
		<link rel="manifest" href="/nextcloud3/core/img/manifest.json" crossorigin="use-credentials">
		<link rel="stylesheet" href="/nextcloud3/core/css/server.css?v=cfcd2084-0">
<link rel="stylesheet" href="/nextcloud3/apps/theming/css/default.css?v=6edf1154-0">
<link rel="stylesheet" href="/nextcloud3/core/c
    at newError (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:4326:2608)
    at WebDavApi.exec (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:4327:277)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
    at FileApiDriverWebDav.put (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:4327:4299)
    at tryAndRepeat (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:3124:21174)
    at async Promise.all (index 0)
    at default_1 (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:3124:10489)
    at V3t.upgrade (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:3124:13786)
    at upgradeSyncTarget (file:///C:/Program%20Files/Joplin/resources/app.asar/main-html.bundle.js:7125:4011)

I'm unclear "who" wants to upgrade from version x to version x+1 and "why". It looks like Joplin is trying to do this?

Hi,

I can recommend a good open source client that will get you connected to your Nextcloud server over WebDAV. It is called rclone. https://rclone.org when creating a remote configuration you can choose Nextcloud. I'm pretty sure that it will be using WebDAV in that configuration. I have a lot of experience with rclone and can assist you in setting up the remote configuration if you should need any help.

Thank you. I think I set up a config using the Joplin/NextCloud URL I've been using, but it being a CMD window, I'm not sure whether it saved it (as I'm back at the command prompt), and I'm not sure what to do next, as the options are too plentiful. If it's easy to explain, please do - otherwise, I need to use a GUI client instead. :slight_smile:

Interestingly (?), using the NextCloud client first fails with https (certificate issue?), then with http is says there have been too many requests and I should wait (I tried fewer than 5 times). Not sure whether this is a clue.

Hi,

Try running these commands.

rclone listremotes

This should produce a one-line list with the entry that you just created. If not you haven't created anything yet.

A new remote connection is created with this command:

rclone config

When you get to the last part of creating the remote there will be an option to quit with the letter q.

They try:

rclone lsd [remote]:

This should list out all of the folders in the root directory of your Cloud Drive. The Joplin folder should be somewhere in there.

If this works successfully here is how you mount the Cloud Drive to a drive letter (windows)

rclone mount [remote]: n:

If you are on Linux or Mac you mount to a folder instead of a drive letter or you can use the folder on Windows if you wish.

rclone mount [remote]: ~/joplin_data

On Windows the folder cannot pre-exist. On Linux you have to create the folder first.

If you would prefer a gui you can take a look at https://rcloneview.com

The mount command might ask you to add caching. Add this flag to the end of the mount command:

--vfs-cache-mode full

This will give you read write caching.

Do this first. This way you can leave Joplin configured as webdav.

Actually, you can also "serve" your cloud drive over webdav! This means that you can run a command that will give you a URL to put in Joplin as your web dev server.

rclone serve webdav remote: --addr 0.0.0.0:8080 --user username --pass password

That's possibly a clue. In Joplin synchronization advanced settings, there should be an option to ignore certificate errors. Try ticking that and see if it helps?

Thank you. I got me the GUI, and I can see the NextCloud/Joplin dir, and I can write/del there as well. Which makes me think the issue is more closely related to Joplin's process(es), in some way - no?

...the check for ignore TLS certificate has been checked for all the test, apparently.

I am also getting this message in Joplin:

The sync target needs to be upgraded before Joplin can sync. The operation may take a few minutes to complete and the app needs to be restarted. To proceed please click on the link. Restart and upgrade

Doing this restart produces the error above. What I'm unclear on is what exactly Joplin is needing to upgrade and why. Could this be related to the version of the Joplin client somehow?

Great!

The next thing is to try Joplin over rclone. You have two choices. You can mount your Cloud Drive to a drive letter and use file system synchronization or you can from the command line only not through the GUI serve the cloud drive as webdav and then you would use that in Joplin.

Instructions are above.

By "mounting", do you mean having the drive be accessible in Rcloneview? That seems to be working already (read/write/del). It doesn't know which drive to sync from, of course - are you saying that this is possible to do manually? Or am I misunderstanding? I'm also not sure I understand the above instructions when using the GUI. :slight_smile:

In Joplin you can choose either file system synchronization or webdav synchronization. If you want to use file system synchronization you can use the GUI to mount a drive.

If you would prefer to use webdav as the protocol for synchronization which I think you do you can only do that in a command window not in the graphical user interface.

Can you check in the Joplin folder on the WebDAV target if it contains a directory called .sync? If it does not, can you create it (and ensure it has appropriate permissions) and then see if Joplin will sync? If it already exists, can you check if it has a version.txt file and if it does, what are the contents of the file?

Sorry for not answering - the forum software cut me off last night (new user = 16 messages a day... strange).

Thank you for your attempts on getting things to work with rclone. I think I got a bit off-track, tho, since I would like to continue sync'ing various devices (Android, Windows), and the effort to get this to work with the work-arounds looks like more than I want. I think I would rather know why my setup from several years just suddenly stopped working without my having made any conscious changes. - Thanks again! :slight_smile: