CardDav from Mac Not Syncing

Operating system and version: Cloudlinux 7.9

Apache or nginx version: Apache 2.4.58

PHP version: 8.3

Nextcloud Hub 7 (28.0.1)

Installed using Quick Install Wizard

Connecting using web interface (Chrome)

The issue you are facing:

Unable to get MAC OS 11.7.1 Contact database to populate in Nextcloud. Set up Mac Calendar no problem — connected to server and all Calendar entries along with Smart Groups populated across all computers and iOS devices.

A header for the Nextcloud database shows in my Mac Contacts app, so I am connected — but no synchronization.

Is this the first time you’ve seen this error? (Y/N):

Y

Steps to replicate it:

  1. Open up Mac Contacts app or Nextcloud Contacts.

  2. Database and Smart Groups from computer don’t populate.

  3. I can add contacts directly into Nextcloud and edit them from my computer, but this creates two distinct databases.

  4. Also, importing contacts doesn’t bring over an extensive set of Groups and Smart Groups.

The output of your Nextcloud log in Admin > Logging:

Error no app in context
Exception
HMAC does not match.
Could not decrypt or decode encrypted session data

Error PHP
TypeError: OCA\UserStatus\Controller\UserStatusController::__construct(): Argument #3 ($userId) must be of type string, null given at /home/xxx/yyy.zzz.com/apps/user_status/lib/Controller/UserStatusController.php#53

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

?php

$CONFIG = array (

‘instanceid’ => ‘ocwrisw1ouep’,

‘passwordsalt’ => ‘nTkEghj*VwB4An76TgUIO88889990rG4NySIzdm8K0u8iLtpzUn’,

‘secret’ => ‘aJln4UPocFE&u&ytFXUKEhUiOZuYPmWARHj8lgJglS8s8WUi3F+XvgtDn’,

‘trusted_domains’ =>

array (

0 => ‘www.xxx.yyy.com’,

1 => ‘xxx.yyy.com’,

2 => ‘http://xxx.yyy.com’,

3 => ‘https://xxx.yyy.com’,

4 => ‘http://www.xxx.yyy.com’,

5 => ‘https://www.xxx.yyy.com’,

),

‘datadirectory’ => ‘/home/zzz/xxx.yyy.com/data’,

‘overwrite.cli.url’ => ‘http://www.xxx.yyy.com’,

‘dbname’ => ‘ddd_xxx’,

‘dbhost’ => ‘localhost’,

‘dbport’ => ‘’,

‘dbtableprefix’ => ‘oc_’,

‘dbuser’ => ‘ddd_xxx’,

‘dbpassword’ => ‘1234567’,

‘mysql.utf8mb4’ => true,

‘installed’ => true,

‘default_phone_region’ => ‘US’,

‘mail_domain’ => ‘web.com’,

‘mail_from_address’ => ‘user’,

‘mail_smtpmode’ => ‘smtp’,

‘mail_sendmailmode’ => ‘smtp’,

);

The output of your Apache/nginx/system log in /var/log/____:

No access. I am on a shared server.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary:

  1. Error occurred while checking server setup

  2. The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds. For enhanced security, it is recommended to enable HSTS as described in the security tips :arrow_upper_right:.

  3. Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the documentation :arrow_upper_right:.

  4. Your web server is not properly set up to resolve “/.well-known/carddav”. Further information can be found in the documentation :arrow_upper_right:.

After extensive research and hands on, here is what I discovered:

  1. Nextcloud (NC) does not auto-migrate contacts from Mac OS or iOS. When a CardDAV account is set up to connect to NC, a NC group label is created (in my case) in the left group column of the desktop OS. All of the contacts in the On My Mac group have to be manually dragged over for them to begin to populate in the NC contact database. This has to be done a few hundred at a time (I did not try importing Vcards 3.0; apparently there are issues when using Vcards 4.0).

  2. Groups (Lists in iOS) and Smart Groups will not be migrated over. In fact, smart groups are not able to be created in NC. Also, if a simple group is made in NC, it will not show outside of NC (groups in NC are apparently used for email activities only).

Now the not so good news:
Both importing and working with contacts is slow. Large databases apparently won’t work at all. Mine had about 2,000 entries. Even after three attempts, I was not able to get all of them over. On one of the attempts, duplicates even appeared.

There are also a number of articles out there where administrators are experiencing difficulties updating using certain devices and in certain directions. I also experienced this malady where some updates would not reach the server or propagate outwards.

This, of coursed, killed any possibility of using NC for contact management.

Some other things I learned along the way:

  1. One of the white papers I read specified that the naming protocol for the v28 server path change to: /remote.php/dav. This seems to work for the OS (albeit slowly), but iOS devices will only function with the: /remote.php/dav/principals/users/name/.

  2. Background jobs under Ajax will not allow for regular changes to be made to contacts. Cron is the only (recommended) option. Also, the standard script that NC provides in their documentation will not work under v.28. This script (which I found on a German site) does: /usr/local/bin/ea-php80 -f /[locale of your Nextcloud folder]/cron.php apc.enable_cli=1.

  3. The two error messages I listed under my Admin Logging are known bugs of v.28.

  4. I’m on a shared server, so NCs Strict-Transport-Security script won’t work. I tried others, but couldn’t get them to work either. Nothing critical here.

  5. While Output Errors 3 and 4 stated my web server was not set up properly, it in fact was per the NC documentation.

As I stated in my original post, NC calendars work beautifully. No issues at all across a number of devices. Refreshes are within seconds.

Unfortunately, despite days of work on it, I had to abandon contacts due to some pretty basic functions that compromised the integrity of my database and my ability to operate risk-free.

I hope this helps others out there.

1 Like