nextcloud / maps

🌍🌏🌎 The whole world fits inside your cloud!
https://apps.nextcloud.com/apps/maps
GNU Affero General Public License v3.0
504 stars 89 forks source link

Failed to load contacts #434

Open Rude-Boy opened 4 years ago

Rude-Boy commented 4 years ago

Nextcloud 18.0.7.1 NextCloudPi 1.28.1 Maps 0.1.6

Hi, Whenever i open Maps or activate my contacts on the map i get the Massage "Failed to load contacts" ("Laden der Kontakte fehlgeschlagen") and no contacts where shown on the map.

Fotos, Devices, Favorites, etc are working, but not contacts.

tell me what you need, and where i can find it (logs, etc) and I will try to give it to you.

Best regards Rude-Boy

tacruc commented 4 years ago

Can you post the browser console log and the bextcloud log?

Rude-Boy commented 4 years ago

how do I do that? (sorry)

edit1: here is the Browser console log. But i still don't know how to get the nextcloud log.

Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf inline blockiert ("script-src"). 2 utils.js:35:9
Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf inline blockiert ("script-src"). 2 content-script.js:40:65
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:551
Proxying an event bus of version 1.1.2 with 0.2.1 ProxyBus.js:65:14
Handlebars is deprecated: please ship your own, this will be removed in Nextcloud 20 globals.js:66:15
Notifications permissions granted App.vue:242
OCA.Viewer initialized Viewer.js:41:10
No OCA.Files app found, viewer is now in standalone mode Viewer.vue:287
XHRGEThttps://xxxxxxx.xx/apps/maps/contacts
[HTTP/2 500 Internal Server Error 481ms]

GET
    https://xxxxxxx.xx/apps/maps/contacts
Status500
Internal Server Error
VersionHTTP/2
Übertragen6,03 KB (5,15 KB Größe)

cache-control
    no-store, no-cache, must-revalidate
content-security-policy
    default-src 'self'; script-src 'self' 'nonce-Tzd6aXRWZVdqU0FuRU96bndmMFRtbXBGSm9kY0Vhc3RQQ2xRa3QvaDh4UT06RElTaHcyUFF6bGdmZU4yejk3WngxQUVDRGJReGRNb2JhUnc3eUkrMGdXTT0='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
content-type
    text/html; charset=UTF-8
date
    Fri, 07 Aug 2020 15:56:56 GMT
expires
    Thu, 19 Nov 1981 08:52:00 GMT
pragma
    no-cache
referrer-policy
    no-referrer
server
    Apache
strict-transport-security
    max-age=15768000; includeSubDomains; preload
x-content-type-options
    nosniff
x-download-options
    noopen
X-Firefox-Spdy
    h2
x-frame-options
    SAMEORIGIN
x-permitted-cross-domain-policies
    none
x-robots-tag
    none
x-xss-protection
    1; mode=block

Accept
    */*
Accept-Encoding
    gzip, deflate, br
Accept-Language
    de,en-US;q=0.7,en;q=0.3
Connection
    keep-alive
Cookie
    __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; ocmkxn4qrngc=80r338da7dprk0trele6avs8sv; oc_sessionPassphrase=G9hLZE1DvQo5eUnY5%2F7dFMR25FVgCR7mpVYjkLAXIBvKkezFwvL2Jx0cRJeyWkS3q6o8CkBkfrbaJJMqd13bmiq%2BJWXQw2hNhP7ivJaQeRLy9cPe0gpMTsusy%2B6M2SqR; i18next=de
DNT
    1
Host
    xxxxxxx.xx
OCS-APIREQUEST
    true
requesttoken
    VftHC/PeCy6/+naalmqR5rvo2yG5cKkl9R82jOFBlxA=:YsMEfceYSFaHkkfOoCHzqNCv8BLUFcgToCpd1rEU5Wc=
TE
    Trailers
User-Agent
    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0

    X-Requested-With
        XMLHttpRequest
tacruc commented 4 years ago

So I guess Your admin, otherwise I don't think you can get it. There is an app called logreader I think it is enabled by default but I'm not shure. After enabling this app you find a menu point for the log in your admin settings. (I'm not shure how it is called exactly in english but something like protocol or log.)

Rude-Boy commented 4 years ago

Yes i am admin, and the logreader helped! I had several addresses with german letters like "ß, ä,ö,ü". Changing them ALL has solved the problem. Even if one Address has one "bad" letter, no contact in maps could be loaded.

tacruc commented 4 years ago

Interesting I will try to get it reproduced.

florianhofhammer commented 4 years ago

I'm running into the same problem. I at first thought that it might be an error related to having a wrong charset or collation set in the database server. However, it seems to be an issue in the data managing frontend, i.e. Nextcloud/the Maps app.

According to my logs, an incorrect string value is inserted into the oc_maps_address_geo table. The error occurs only for the adr_norm database column. As far as I can see, there is an error with the conversion of UTF-8 characters into bytes. For example, the umlaut letter ü in the adr column is represented as \u00fc. When converting it into the hexadecimal representation for the adr_norm column, the expected value (according to the UTF-8 standard) is \xc3\xbc. According to the log, however, it is converted to \xe3\xbc. This change in the first byte violates the UTF-8 character set which leads to a refusal to accept the value by the database backend/server.

I am using Nextcloud 19.0.3, Maps 0.1.6. Please let me know if you need any more debug information or further description of the error from my side.

florianhofhammer commented 3 years ago

@tacruc Sorry for pinging you, are there any news on that? I unfortunately still have the same problem on Nextcloud 20.0.4, Maps 0.1.8

tacruc commented 3 years ago

Could you add some details about the database your using? We're or bedder @eneiluj is currently quite busy reimplementing the UI #510, so I guess it might take some time.

tacruc commented 3 years ago

And can you give more details on your setup? I'm running NC maps with 250 German Contacts with all wired combinations of special Characters, without any issue. I could not reproduce the error on my production or my development system.

The photos app has a nice Bug template with inspirations of usefull information: https://raw.githubusercontent.com/nextcloud/photos/master/.github/ISSUE_TEMPLATE/bug_report.md Additionally the configured charsets used in the different systems (clients, PHP, Database) would be good.

Rude-Boy commented 3 years ago

I have installed some updates in the meantime and now the problem no longer occurs. I'm sorry, but I can't say since which update the problem is fixed.

Nextcloud 18.0.7.1 -> 20.0.3.2 NextCloudPi 1.28.1 -> 1.33.0 Maps 0.1.6 -> 0.1.8

florianhofhammer commented 3 years ago

Please find below additional information:

Describe the bug

The Maps app can't display contacts' addresses.

To Reproduce

Steps to reproduce the behavior:

  1. Open the Nextcloud instance in the browser (web browser shouldn't matter as it is a server/database related problem)
  2. Click on 'Maps'
  3. Maps loads, shows error 'Failed to load contacts' in top right corner

Expected behavior

The contacts' addresses are shown as points on the map

Server

Desktop:

Smartphone:

Browser log

jquery.js:9175 GET https://NEXTCLOUD_LOCATION/apps/maps/contacts 500
send @ jquery.js:9175
ajax @ jquery.js:8656
callForContacts @ contactsController.js:613
showLayer @ contactsController.js:116
toggleLayer @ contactsController.js:136
(anonymous) @ script.js:249
l @ jquery.js:3187
fireWith @ jquery.js:3317
M @ jquery.js:8757
(anonymous) @ jquery.js:9123
load (async)
send @ jquery.js:9142
ajax @ jquery.js:8656
restoreOptions @ script.js:124
(anonymous) @ script.js:2142
l @ jquery.js:3187
add @ jquery.js:3246
m.fn.ready @ jquery.js:3496
m.fn.init @ jquery.js:2927
e.fn.init @ jquery-migrate.min.js:2
m @ jquery.js:75
(anonymous) @ script.js:2119
(anonymous) @ script.js:66
A @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ script.js?v=afd10b39-14:1

Apart from that part of the log, only deprecation warnings for the global jQuery occur several times:

globals.js:60 $ is deprecated: The global jQuery is deprecated. It will be updated to v3.x in Nextcloud 21. In later versions of Nextcloud it might be removed completely. Please ship your own.
ie @ globals.js:60
get @ globals.js:91
(anonymous) @ photosController.js:542
l @ jquery.js:3187
fireWith @ jquery.js:3317
M @ jquery.js:8757
(anonymous) @ jquery.js:9123

Additional context

According to the NC logs, an incorrect string value is inserted into the oc_maps_address_geo table. The error occurs only for the adr_norm database column. As far as I can see, there is an error with the conversion of UTF-8 characters into bytes. For example, the umlaut letter ü in the adr column is represented as \u00fc. When converting it into the hexadecimal representation for the adr_norm column, the expected value (according to the UTF-8 standard) is \xc3\xbc. According to the log, however, it is converted to \xe3\xbc. This change in the first byte violates the UTF-8 character set which leads to a refusal to accept the value by the database backend/server.

Database backend:

arkhi commented 2 years ago

Hello!

I also had the issue with some XML remains being present in addresses (<,>, /, etc.), which prevented contacts from appearing.

Checking the log for the error with something like sudo tail -n 2000 -f PATH_TO_DATA_DIRECTORY/nextcloud.log | grep contacts, then asking for contacts to display, helped to identify the problem mentioned above and solve it by cleaning the address book.