nextcloud / contacts

📇 Contacts app for Nextcloud
https://apps.nextcloud.com/apps/contacts
GNU Affero General Public License v3.0
563 stars 169 forks source link

Contacts not show in app. #3188

Open CristianSw opened 1 year ago

CristianSw commented 1 year ago

Describe the bug

Its fresh install of nextcloud on ubuntu 22.4 and when try to import contacts from vcf file contacts seem to be added, but when sync with phone, or just press F5 after import is done contacts dissapeared and There are not contacts yet message displayed. After that I think that may be vcf file is the problem, I try another one and resut was the same. After that I start thinking that problem is with importing functionality, and try to add some test contact, result the same, contact appear and after refreshing page dissapear. After that I checked database to be sure that database is ok, and its not broken. So in table oc_cards contacts are present, and in table oc_cards_properties info is present. From here I understand that may be this is a app issue. Next some images with debugging from developer console. image This is network page when importing contacts from vcf file: image This is console output when started importing: image

this is response from one of the 400 bad request messages: [HTTP/1.1 400 Bad Request 78ms] <?xml version="1.0" encoding="utf-8"?>

Sabre\DAV\Exception\BadRequest VCard object with uid already exists in this addressbook collection. and also appear this error in console output ![image](https://user-images.githubusercontent.com/60692725/213716594-db0c8988-60c1-40ba-8d0d-75ee91d008a3.png) Also from the logging functionality I get this error messages Validation error in vCard: CardDAV servers are not allowed to accept vCard 2.1. Vcards created from my another instance of nextcloud, it was version 22 I think. ​So thats all that I collected Here is reproducing that issue on video. https://user-images.githubusercontent.com/60692725/213726438-f4a90e73-bebf-4006-94a7-c7cc42f07e16.mp4 ### Steps to reproduce First scenario 1. Go to Contacts app. 2. Click on Contacts Settings 3. Add address book if its not present, or if its present click on import contacts. 4. Select vcf file from PC or cloud. 5. Contacts seems to be imported. 6. Refresh page with Contacts. Second scenario 1. Go to Contacts app. 2. Add new Test contact with random information. 3. Contact seems to be saved. 4. Refresh page. Third scenario 1. Go to Contacts app. 2. Add new Test contact with random information. (or import vcf both valid cases). 3. Update phone contacts list and see that contacts are present. 4. Refresh browser page. ### Expected behavior Contacts are present and available in all 3 scenarios. ### Actual behavior Contacts are not shown in app, but they are present in DB as described. Contacts unable to import. Contacts dont sync with phone. ### Contact version 5.0.2 ### Operating system Ubuntu 22.04.1 LTS x86_64 ### PHP engine version PHP 8.1 ### Web server Apache (supported) ### Database MariaDB ### Additional info _No response_
CristianSw commented 1 year ago

Also created a new server and install nextcloud as snap package. The same issue is present, so its not my mistake when installing and configuring step by step my server. Hope to help in fixing this, because I heavily need this functionallity.

CristianSw commented 1 year ago

Fixed by sudo -u www-data php8.1 --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:repair

and after that manually deleting all the contacts info from oc_cards , oc_cards_properties tables and from adress book tables oc_addressbooks and oc_addressbookchanges , delete all of thhem by adressbook id value. For example:

delete from oc_cards_properties where addressbookid in (15,13,12,11,9,8); And run again sudo -u www-data php8.1 --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:repair

After that added manually all the contacts from vcf file that I have exported from nextcloud 22. and contacts saved ok. make an vcard file from current instalation just to check and all look good, all is importing well. From here I think that problem was with vcard file that I was exported from previous version of nextcloud that was installed.

So actual status after all this actions is that all working as expected, contacts are added to DB and saved correctly, also contacts are successfuly sync with phone and PC. Fresh exported vcard file work well when delete all the contacts and importing them again.

This issue I think may be closed as I find a way how to fix that, but my recommendation for devs is to check please compatibility with all vcard files to work well, because for someone this could be a problem, assuming they make fresh instal from someone guide and have exported their contacts from another nextcloud instance that they have or from some device, and when importing appear this problem. BTW I located as I think issue, and right steps to reproduce for me was Step 1 an old instance of nextcloud 22 with contacts, Step 2 make and vcard file and save them on local drive Step 3 proceed with fresh step by step install of nextcloud 25 Step 4 import this vcard file.

This isue appear.