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

Unable to Import Contacts When Birthdays Calendar Enabled #1601

Closed
bobj82 opened this issue Apr 23, 2020 · 1 comment
Closed

Unable to Import Contacts When Birthdays Calendar Enabled #1601

bobj82 opened this issue Apr 23, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@bobj82
Copy link

bobj82 commented Apr 23, 2020

Overview

I ran into a problem importing contacts caused by the Calendar birthdays. People should be able to correct the issue easily. Better error reporting from the imports wizard is needed.

When I tried to import contacts, the popup window would list xxx Failed. I searched the web and didn't find anything helpful. Ultimately, by looking at a failed contact's response payload in the browser debugger, I figured out the root cause.

In order to clean up the categories on my contacts, and to consolidate address books, I exported my existing addresses from the Contacts app. But, I wasn't able to import them back into the system. I ultimately determined the root cause to be the "Enable birthday calendars" setting in the Calendar application.

When the "Enable birthday calendars" setting is enabled in Nextcloud, the software stores the UID of the contact in a special table for contact birthdays. During import, if a contact UID matches an existing contact, the contact will fail with no indication of which contact or why. The end result is that when I tried to add the contacts with birthdays associated to them back into Nextcloud, the "new" contact fails because there is an existing UID in the birthdays calendar.

To solve the problem, uncheck the "Enable birthday calendars" setting. This will cause Nextcloud to clear the entries from it's tables. At that point, you can import your contacts and avoid this issue.

To Reproduce

The overview explains how to find the problem and it's solution. These steps to reproduce the behavior are to provide additional detail.

  1. Go to the Calendar application.

  2. Select Settings and import.

  3. Verify that "Enable birthday calendar" is enabled.

  4. Go to the Contacts application.

  5. Select Settings

  6. Click the three dots for one of your address books.

  7. Click Download and save the contacts to a file.

  8. Only if you are qualified, delete the addressbook card entries as follows:
    8.0. Back up the database!
    8.1. Connect to the database with your SQL client.
    8.2. Locate the address book in question by finding the correct id using "select * from nextcloud.oc_addressbooks;" Save the ID for use in 8.3.1 and 8.3.2.
    8.3. In my case, I was replacing the entire addressbook, so I executed:
    8.3.1. delete * from oc_cards where addressbookid=_[the id found in 5.2]_;
    8.3.2. delete * from oc_cards_properties where addressbookid=_[the id found in 5.2]_;
    8.4. Exit the database client.

  9. Return to the Nextcloud window.

  10. Change from the Contacts app to another app and back. The addressbook in question will be empty.

  11. Click on Settings.

  12. Click on Import contacts and import the contacts you previously exported.

  13. In the browser debugger, you can locate one of the cards that failed to import. When you see the response, it will indicate a calendar error instead of a contact error. That's the clue that the problem lies with the birthdays calendar.
    12.1. Status code: 400.
    12.2. Response Payload:
    <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\DAV\Exception\BadRequest</s:exception> <s:message>Calendar object with uid already exists in this calendar collection.</s:message> </d:error>

  14. Go to the Calendar application.

  15. Select Settings and import.

  16. Verify that "Enable birthday calendar" is disabled.

  17. Repeat steps 8 through 11. The contacts that failed to import will be correctly import.

  18. Re-enable Birthday calendars by repeating steps 1 through 3.

Expected behavior

The error message for a failure to import a contact should be provide details about the failed entry and the console log should also provide information.

Console Log

For example, the console log should provide and error message with

Birthday Calendars Issue
Contact UID: [UID] Name "John Doe" failed with message "Calendar object with uid already exists in this calendar collection. This could be caused by having the Enable birthday calendar on the Calendar application.
Duplicate ID
Contact UID: [UID] Name "John Doe" failed with message "VCard object with uid already exists in this addressbook collection."

Browser Import Window

The import window should provide a table of failed imports along with the message. For example:

UID Name Failure Reason
d22de351-bef7-4b7a-a4ab-8696816709e2 John Doe Calendar object with uid already exists in this calendar collection.
d22de351-bef7-4b7a-a4ab-8696816709e3 Jane Doe VCard object with uid already exists in this addressbook collection.
... ... ...

Actual behavior

Import popup window only lists a count of the number of failed contacts.

Browser Console Log Entries

13:14:03.684
Error: ""
C dist.js:1
r dist.js:1
e dist.js:1
e dist.js:1
e dist.js:1
onreadystatechange dist.js:1
addressbooks.js:427:14

Browser Responses

Birthday Calendars Issue
  Sabre\DAV\Exception\BadRequest
  Calendar object with uid already exists in this calendar collection.
Duplicate Contact
  Sabre\DAV\Exception\BadRequest
  VCard object with uid already exists in this addressbook collection.

Server configuration

Operating system: Linux 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l

Web server: Apache (apache2handler)

Database: MariaDB 10.3.22

PHP version: 7.3.14-1~deb10u1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, sodium, standard, apache2handler, mysqlnd, PDO, xml, apcu, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, intl, json, exif, mysqli, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, Zend OPcache

Nextcloud version: 18.0.3 - 18.0.3.0

Contacts version: 3.3.0

Updated from an older Nextcloud or fresh install: Updated, but not recently.

Signing status:
Array
(
)

List of activated apps:
Enabled:

  • activity: 2.11.0
  • admin_audit: 1.8.0
  • apporder: 0.9.0
  • audioplayer: 2.10.0
  • bookmarks: 2.3.4
  • calendar: 2.0.3
  • checksum: 0.4.4
  • cloud_federation_api: 1.1.0
  • comments: 1.8.0
  • contacts: 3.3.0
  • dav: 1.14.0
  • drawio: 0.9.5
  • event_update_notification: 1.0.1
  • external: 3.5.0
  • federatedfilesharing: 1.8.0
  • files: 1.13.1
  • files_external: 1.9.0
  • files_markdown: 2.2.0
  • files_pdfviewer: 1.7.0
  • files_rightclick: 0.15.2
  • files_sharing: 1.10.1
  • files_trashbin: 1.8.0
  • files_versions: 1.11.0
  • files_videoplayer: 1.7.0
  • firstrunwizard: 2.7.0
  • fulltextsearch: 1.4.1
  • gpxedit: 0.0.13
  • gpxmotion: 0.0.11
  • gpxpod: 4.2.1
  • issuetemplate: 0.6.0
  • keeweb: 0.6.2
  • logreader: 2.3.0
  • lookup_server_connector: 1.6.0
  • mail: 1.3.2
  • maps: 0.1.6
  • metadata: 0.11.1
  • music: 0.13.2
  • news: 14.1.3
  • nextcloud_announcements: 1.7.0
  • notes: 3.2.0
  • notifications: 2.6.0
  • oauth2: 1.6.0
  • occweb: 0.0.7
  • password_policy: 1.8.0
  • photos: 1.0.0
  • privacy: 1.2.0
  • provisioning_api: 1.8.0
  • qownnotesapi: 20.1.0
  • recommendations: 0.6.0
  • serverinfo: 1.8.0
  • settings: 1.0.0
  • sharebymail: 1.8.0
  • spreed: 8.0.7
  • support: 1.1.0
  • survey_client: 1.6.0
  • systemtags: 1.8.0
  • tasks: 0.12.1
  • text: 2.0.0
  • theming: 1.9.0
  • twofactor_backupcodes: 1.7.0
  • twofactor_totp: 4.1.3
  • updatenotification: 1.8.0
  • video_converter: 0.1.3
  • viewer: 1.2.0
  • workflowengine: 2.0.0

Nextcloud configuration:
{
"system": {
"instanceid": "REMOVED SENSITIVE VALUE",
"passwordsalt": "REMOVED SENSITIVE VALUE",
"secret": "REMOVED SENSITIVE VALUE",
"trusted_domains": [
"REMOVED SENSITIVE VALUE",
],
"datadirectory": "REMOVED SENSITIVE VALUE",
"overwrite.cli.url": "REMOVED SENSITIVE VALUE",
"dbtype": "mysql",
"version": "18.0.3.0",
"dbname": "REMOVED SENSITIVE VALUE",
"dbhost": "REMOVED SENSITIVE VALUE",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "REMOVED SENSITIVE VALUE",
"dbpassword": "REMOVED SENSITIVE VALUE",
"installed": true,
"loglevel": 2,
"logfile": "/var/log/nextcloud/nextcloud.log",
"maintenance": false,
"mail_from_address": "REMOVED SENSITIVE VALUE",
"mail_smtpmode": "smtp",
"mail_domain": "REMOVED SENSITIVE VALUE",
"mail_smtpauth": 1,
"mail_smtpauthtype": "LOGIN",
"mail_smtphost": "REMOVED SENSITIVE VALUE",
"mail_smtpport": "465",
"mail_smtpname": "REMOVED SENSITIVE VALUE",
"mail_smtppassword": "REMOVED SENSITIVE VALUE",
"mail_smtpsecure": "ssl",
"theme": "",
"updater.secret": "REMOVED SENSITIVE VALUE",
"memcache.local": "\OC\Memcache\Redis",
"memcache.distributed": "\OC\Memcache\Redis",
"filelocking.enabled": "true",
"redis": {
"host": "REMOVED SENSITIVE VALUE",
"port": 0,
"timeout": 0
}
}
}

Client configuration

Browser: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

@bobj82 bobj82 added 0. Needs triage bug Something isn't working labels Apr 23, 2020
@skjnldsv
Copy link
Member

skjnldsv commented Apr 23, 2020

Hey! :)

this is a duplicate of #1581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants