You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Go to the Calendar application.
Select Settings and import.
Verify that "Enable birthday calendar" is enabled.
Go to the Contacts application.
Select Settings
Click the three dots for one of your address books.
Click Download and save the contacts to a file.
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.
Return to the Nextcloud window.
Change from the Contacts app to another app and back. The addressbook in question will be empty.
Click on Settings.
Click on Import contacts and import the contacts you previously exported.
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>
Go to the Calendar application.
Select Settings and import.
Verify that "Enable birthday calendar" is disabled.
Repeat steps 8 through 11. The contacts that failed to import will be correctly import.
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
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.
Go to the Calendar application.
Select Settings and import.
Verify that "Enable birthday calendar" is enabled.
Go to the Contacts application.
Select Settings
Click the three dots for one of your address books.
Click Download and save the contacts to a file.
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.
Return to the Nextcloud window.
Change from the Contacts app to another app and back. The addressbook in question will be empty.
Click on Settings.
Click on Import contacts and import the contacts you previously exported.
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>
Go to the Calendar application.
Select Settings and import.
Verify that "Enable birthday calendar" is disabled.
Repeat steps 8 through 11. The contacts that failed to import will be correctly import.
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
Browser Import Window
The import window should provide a table of failed imports along with the message. For example:
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
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:
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
The text was updated successfully, but these errors were encountered: