Baikal icon indicating copy to clipboard operation
Baikal copied to clipboard

macOS Calendar app NSCocoaErrorDomain error 1570 when sharing a calendar

Open ed-cetera opened this issue 3 years ago • 12 comments

I have a setup running Baïkal 0.8.0 with PHP 8.0 and NGINX. During installation I basically followed the guide on https://sabre.io/baikal/install/. Both CalDAV and CardDAV work fine for independent users accessing the server via macOS and/or iOS Contacts/Calendar apps.

However, the moment I share a calendar with another user, the macOS Calendar app stops working for ~both users~ the user the calendar is shared with. The error is "NSCocoaErrorDomain error 1570". I tried both macOS 10.15 "Catalina" and macOS 11 "Big Sur" – same result. NSCocoaErrorDomain error 1570 This behavior is independent of whether the sharing is configured with the Calendar app or the Baïkal calendar web interface.

There is no error in the PHP logs. The macOS Console is a little more communicative but I have no experience with macOS programming or CalDAV internals. Google didn't help either.

Validation error: Error Domain=NSCocoaErrorDomain Code=1570 "accessLevel is a required value." UserInfo={
    CalManagedObjectType = CalManagedSharee;
    NSLocalizedDescription = "accessLevel is a required value.";
    NSValidationErrorKey = accessLevel;
    NSValidationErrorObject = "<CalManagedSharee: 0x7ff0754dd470> (entity: Sharee; id: 0x2b41148bcdbe232b <x-coredata://7389159A-FD98-408E-8B44-988103C23CFC/Sharee/p686>; data: {\n    accessLevel = nil;\n    address = \"/dav.php/principals/username\";\n    calendar = \"0x2b41148b22be07eb <x-coredata://7389159A-FD98-408E-8B44-988103C23CFC/CalDAVCalendar/p274>\";\n    commonName = nil;\n    status = \"invite-accepted\";\n})";
}

What am I doing wrong? What to check next? Any ideas, how to solve this issue?

Sidenote: When sharing a calendar, the iOS calendar app shows the calendar as shared by the user it is actually shared with.

ed-cetera avatar Mar 20 '21 10:03 ed-cetera

Did you use the web ui to share the calendar?

Tntdruid avatar Mar 20 '21 11:03 Tntdruid

@Tntdruid Both, the web UI or the macOS Calendar apps ("Catalina" and "Big Sur").

This behavior is independent of whether the sharing is configured with the Calendar app or the Baïkal calendar web interface.

ed-cetera avatar Mar 20 '21 15:03 ed-cetera

I can confirm that I am seeing the same error when sharing a calendar with another user

bjw-s avatar Apr 07 '21 09:04 bjw-s

Confirmed. Tested with Apache/nginx and PHP 7.4 and 8.0.

Anyone found a workaround and/or tested it with baikal 0.7?

UnbekanntesPferd avatar May 19 '21 18:05 UnbekanntesPferd

I observe the same here. Has anyone found a workaround in the meantime?

alexBethke avatar Jul 07 '21 12:07 alexBethke

Same issue on 0.8.

Subscribed/shared calendars still seem to be a pain with Baikal, a partial workaround (using a completely different workflow) can be found here. Still wrestling with this myself.

mrzool avatar Jul 11 '21 13:07 mrzool

Same issue on 0.9.1

karlitos avatar May 28 '22 13:05 karlitos

As a workaround on MacOs I found following workaround: In the calendar app go to File -> New Calendar Subscription and enter URL in Format: https://userName:[email protected]/dav.php/calendars/userName/calendarName/?export - ~~then you still need to insert the users credentials, but~~ in such a way, my wife and me managed to have read-only each others calendars in MacOs calendar APP

karlitos avatar May 28 '22 14:05 karlitos

I also just hit this after adding Baikal to a second Mac. The same shared calendar is working fine on the same account but on Android with DavX. The error code I get is the exact same but 1560 instead of 1570.

Edit: After unsharing the calendars via the iOS client, syncing works again, but upon resharing them I get a 1570 on the second MacOS machine.

vaskozl avatar Jun 20 '23 20:06 vaskozl

I was able to identify the issue and fix it for my instance. Thanks to @ed-cetera for the Console logs.

If you go to dav.php/calendars/user@domain/ and you click on the shared calendar you'll see that the owner (principal) is listed under cs:invite as an invited user. That by itself is not problematic and is expected, but it is a problem that the access level is not defined and left as a self closing xml tag<cs:access/>. MacOS doesn't like that as it think all invited user should have an access level.

How do we make MacOS mail happy? Give the principals an access level:

$ sqlite config/db/db.sqlite
UPDATE calendarinsatnces SET access = 1 WHERE access IS NULL;

Now the calendars show up fine on all devices. For some reason calendar owners have their access level set to NULL instead of 1 (owner).

vaskozl avatar Jun 20 '23 22:06 vaskozl

This only appears to be an issue with sqlite as the DB where the default is not set to 1: https://github.com/sabre-io/Baikal/blob/aa7e340113545f8be18b6e8c44d001fc4e684526/Core/Resources/Db/SQLite/db.sql#L53

The MySQL table sets the default to 1 properly: https://github.com/sabre-io/Baikal/blob/aa7e340113545f8be18b6e8c44d001fc4e684526/Core/Resources/Db/MySQL/db.sql#L55

vaskozl avatar Jun 20 '23 22:06 vaskozl

You are right, there seems to be something wrong there. I don't know if it will fix the issue (I don't have access to a MacOS device), but the difference between MySQL and SQLite should definitely be resolved. I will create a PR for that, testers welcome.

ByteHamster avatar Jun 21 '23 15:06 ByteHamster

I think this issue can now be closed, I haven't had this problem since the fix.

vaskozl avatar Apr 04 '24 09:04 vaskozl