Skip to content

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

Open
@onxipole

Description

@onxipole

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()
#1 /home/mydomain/public_html/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\Sync\Plugin->Sabre\DAV\Sync{closure}()
#2 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/CorePlugin.php(685): Sabre\DAV\Server->emit()
#3 /home/mydomain/public_html/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\DAV\CorePlugin->httpReport()
#4 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(472): Sabre\DAV\Server->emit()
#5 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(253): Sabre\DAV\Server->invokeMethod()
#6 /home/mydomain/public_html/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\DAV\Server->start()
#7 /home/mydomain/public_html/Core/Frameworks/Baikal/Core/Server.php(119): Sabre\DAV\Server->exec()
#8 /home/mydomain/public_html/html/dav.php(69): Baikal\Core\Server->start()
#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 !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions