iCloud Sync Issue



  • Hi,

    I might have found an issue with iCloud syncing in the DAVx5 application.
    The initial sync seems to be working, but after that, when a contact is changed in iCloud, it’s not synced back to the application.
    I can see the following request in the logs after a change:

    GET https://p51-contacts.icloud.com/<redacted>/carddavhome/card/<redacted>.vcf
    

    and it returns

    500 Internal Server Error
    

    It looks like iCloud doesn’t support the GET method in this case. If I manually send the same request using the REPORT verb, I get back the requested data:

    REPORT https://p51-contacts.icloud.com/<redacted>/carddavhome/card/<redacted>.vcf
    
    <?xml version="1.0" encoding="UTF-8"?>
    <multistatus xmlns="DAV:" xmlns:CD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
        <response>
            <href>redacted</href>
            <propstat>
                <prop>
                    <getetag>"redacted"</getetag>
                    <address-data xmlns="urn:ietf:params:xml:ns:carddav">
                      redacted
    		</address-data>
                </prop>
                <status>HTTP/1.1 200 OK</status>
            </propstat>
        </response>
    </multistatus>
    

    Also, this sync is only tried once, the next sync uses the new ETag / sync-token and the issue doesn’t appear anymore (even though the contact wasn’t synced properly).
    Let me know if you need more information!


  • admin

    Thank you for the report. Can you export the contact and send us the .vcf to support-en@davx5.com?



  • Sure, but even something very simple like this triggers it (this is a new contact I have just created):

    <?xml version="1.0" encoding="UTF-8"?>
    <multistatus xmlns="DAV:" xmlns:CD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
        <response>
            <href>/<redacted>/carddavhome/card/5D6CB1A1-0D02-4C31-AA8E-1C7A4B78C8C7.vcf</href>
            <propstat>
                <prop>
                    <getetag>"k7el6v1m"</getetag>
                    <address-data xmlns="urn:ietf:params:xml:ns:carddav">BEGIN:VCARD&#13;
    VERSION:3.0&#13;
    UID:5D6CB1A1-0D02-4C31-AA8E-1C7A4B78C8C7&#13;
    N:Contact;Test;;;&#13;
    FN:Test Contact&#13;
    PRODID:-//Apple Inc.//iCloud Web Address Book 2003B20//EN&#13;
    REV:2020-03-05T02:07:56Z&#13;
    END:VCARD&#13;
    </address-data>
                </prop>
                <status>HTTP/1.1 200 OK</status>
            </propstat>
        </response>
    </multistatus>
    

    I think the problem is on Apple’s side in this case, because it doesn’t support a simple GET request on the URL when REPORT with addressbook-multiget works.
    Also DAVx5 doesn’t handle the error properly and won’t try to sync it again later.


  • developer

    @wimex said in iCloud Sync Issue:

    I think the problem is on Apple’s side in this case, because it doesn’t support a simple GET request on the URL when REPORT with addressbook-multiget works.

    I agree with that.

    Also DAVx5 doesn’t handle the error properly and won’t try to sync it again later.

    As far as I know, DAVx5 shows an error message in this case ant doesn’t continue synchronization. Are you really sure that you didn’t get a notification and DAVx5 just ignored the error message on GET?

    Is there a way to reproduce the 500 – i.e. uploading the vCard from your previous message to iCloud?



  • As far as I know, DAVx5 shows an error message in this case ant doesn’t continue synchronization. Are you really sure that you didn’t get a notification and DAVx5 just ignored the error message on GET?

    Yes, I did get the notification about the error, but when I start synchronization again, the app uses the new sync-token and doesn’t run into the issue anymore because now there is nothing new to sync.

    Is there a way to reproduce the 500 – i.e. uploading the vCard from your previous message to iCloud?

    Sure, it’s easy to reproduce, just create a new contact in iCloud (with any content) and try to run the GET request that DAVx5 runs:

    GET https://p51-contacts.icloud.com/<userid>/carddavhome/card/<contactid>.vcf
    

    And you can get the URL using the sync-collection method with the getetag property.


  • developer

    @wimex said in iCloud Sync Issue:

    Yes, I did get the notification about the error, but when I start synchronization again, the app uses the new sync-token and doesn’t run into the issue anymore because now there is nothing new to sync.

    I’ll have a look at that. That’s not how I have in mind that it should be 🙂

    Edit: I could reproduce that.


  • developer

    Should be fixed with https://gitlab.com/bitfireAT/davx5-ose/-/commit/3dc2aa65dfdcbf9cb9fb8ce87c98bbb19994c98d.

    Where did you get DAVx5 from? Can you test a beta version?



  • @rfc2822 I got it from the Play Store, but I can test the beta version, if you send me an APK. You can use the email address on my profile.


  • developer

    @wimex We will upload a beta to the play store soon. Please join it here: https://play.google.com/apps/testing/at.bitfire.davdroid


  • admin

    @wimex Please try the new beta (2.6.5-beta1) which has been released in the beta channel already and tell us if it works! You will need to de-select, press the sync button, and re-select all address books and then press the sync button again. Then all contacts should be transferred, or if there is an error, the sync will stop. It will not continue until the error is fixed. Now additionally we don’t use a single GET method any more because iCloud crashes when requesting a single resource with GET (🤣), instead we now always use multi-get, which works. So if you simply add one contact in iCloud it should work again.



  • Sorry I didn’t have time to try it during the weekend but I tested it now and it seems to be working.
    Thank you for the quick fix!



Similar topics

  • 27
  • 4
  • 5