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

Sabre\DAV\Exception\InvalidSyncToken: Invalid or unknown sync token #1202

Open
onxipole opened this issue Sep 29, 2023 · 0 comments
Open

Sabre\DAV\Exception\InvalidSyncToken: Invalid or unknown sync token #1202

onxipole opened this issue Sep 29, 2023 · 0 comments

Comments

@onxipole
Copy link

Hello everyone and sorry if this issue has already been documented.

I have repeated errors of the same kind in my php error log, and the sync process between client and server doesn't work :

[29-Sep-2023 10:35:00 Europe/Paris] Sabre\DAV\Exception\InvalidSyncToken: Invalid or unknown sync token in /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Sync/Plugin.php:116
Stack trace:
#0 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Sync/Plugin.php(62): Sabre\DAV\Sync\Plugin->syncCollection()
sabre-io/dav#1 /home/mydomain/public_html/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\Sync\Plugin->Sabre\DAV\Sync{closure}()
sabre-io/dav#2 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/CorePlugin.php(685): Sabre\DAV\Server->emit()
sabre-io/dav#3 /home/mydomain/public_html/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\CorePlugin->httpReport()
sabre-io/dav#4 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(472): Sabre\DAV\Server->emit()
sabre-io/dav#5 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(253): Sabre\DAV\Server->invokeMethod()
sabre-io/dav#6 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
sabre-io/dav#7 /home/mydomain/public_html/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
sabre-io/dav#8 /home/mydomain/public_html/html/dav.php(69): Baikal\Core\Server->start()
sabre-io/dav#9 {main}

I tried to update a contact (or add a new one), it stays on the client but doesn't record in the server, meaning it is not available for other clients.

The section it is referring to is that one :

$syncToken = $report->syncToken;
if (!is_null($syncToken)) {
// Sync-token must start with our prefix
if (self::SYNCTOKEN_PREFIX !== substr($syncToken, 0, strlen(self::SYNCTOKEN_PREFIX))) {
throw new DAV\Exception\InvalidSyncToken('Invalid or unknown sync token');
}

By performing searches on the Internet, I found a post with this workaround :

Since I really wanted the sync to work, I hacked my own system as follows:
After https://github.com/sabre-io/dav/blob/3.2/lib/DAV/Sync/Plugin.php#L119 (which is in lib/composer/sabre/dav/lib/DAV/Sync/Plugin.php) I added the following.
Definitely not a final solution; use at your own risk, I don't know the cardDAV specs nor the ownCloud system.

    $syncToken = $report->syncToken;
    // very crude macOS Mojave (10.14) Contacts sync "fix"
    // @see https://github.com/owncloud/core/issues/30820
    if ( \preg_match('/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/', $syncToken) ) {
      $syncToken = null;
    }

ownCloud now just outputs the full REPORT and the contacts app syncs correctly (as far as I have tested it with ownCloud, macOS and my Android phone).

What to think about this ?

Mac OS 10.13.6
DEBIAN 10 - Baïkal 0.9.3

Thanks everyone !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant