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

[Bug]: Javascript error when enabling Contacts #898

Closed jimbolaya closed 1 year ago

jimbolaya commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

I just upgraded php from 7.4 to 8.0 and have been encountering this error when I attempt to enable contacts on the maps:

Failed to load contacts:
Nextcloud
<div id="nojavascript">
<div>
This application requires JavaScript for correct operation. Please <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer noopener">enable JavaScript</a> and reload the page. </div>
</div>
Nextcloud
Internal Server Error
The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.
Technical details
Remote Address: 192.168.40.1
Request ID: Y5KgOXtvGpe_nKSGXP7FrAAAAAg
Nextcloud – a safe home for all your data 

(white space removed)

Looking up my nextcloud.log, I found the following {"reqId":"Y5Kfe0u3oSZGi26HoAHp1AAAAAY","level":3,"time":"2022-12-09T02:37:47+00:00","remoteAddr":"192.168.40.1","user":"myuser","app":"index","method":"GET","url":"/index.php/apps/maps/contacts","message":"strlen(): Argument #1 ($string) must be of type string, array given in file '/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 74","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0","version":"23.0.12.2","exception":{"Exception":"Exception","Message":"strlen(): Argument #1 ($string) must be of type string, array given in file '/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 74","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},

My contacts fail to show up on the Maps

Steps to reproduce

  1. Upgrade tp php 8.0
  2. Open Maps app in Nextcloud

Expected behavior

I don't really expect to see large errors on the Maps screen.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install of the server?

None

Is this bug present after an update or on a fresh install of the app?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.12.2",
        "installed": true,
        "maintenance": false,
        "forcessl": true,
        "theme": "",
        "loglevel": 0,
        "log_rotate_size": 10485760,
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
            ""***REMOVED SENSITIVE VALUE***"
        ],
        "secret": "***REMOVED SENSITIVE VALUE***",
        "share_folder": "\/Shared",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "US",
        "updater.release.channel": "stable",
        "appstore.experimental.enabled": true,
        "trashbin_retention_obligation": "auto, 180",
        "version_retention_obligation": "auto, 180",
        "auth.bruteforce.protection.enabled": true,
        "updater.server.url": "https:\/\/updates.nextcloud.com\/updater_server\/",
        "overwrite.cli.url": "https:\/\/myserver.org",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mysql.utf8mb4": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***",
            "timeout": 1.5
        },
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "ldapIgnoreNamingRules": false,
        "app_install_overwrite": [
            "ocsms",
            "flowupload",
            "deck",
            "announcementcenter"
        ],
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - admin_audit: 1.13.0
  - apporder: 0.15.0
  - audioplayer: 3.3.1
  - bookmarks: 11.0.4
  - bruteforcesettings: 2.4.0
  - calendar: 3.5.2
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - contacts: 4.2.2
  - contactsinteraction: 1.4.0
  - cookbook: 0.9.18
  - dav: 1.21.0
  - deck: 1.6.5
  - duplicatefinder: 0.0.15
  - event_update_notification: 2.0.0
  - federatedfilesharing: 1.13.0
  - files: 1.18.0
  - files_external: 1.15.0
  - files_mindmap: 0.0.27
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - flowupload: 1.1.3
  - gestion: 2.2.2
  - health: 1.6.1
  - keeweb: 0.6.10
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - mail: 1.14.5
  - maps: 0.2.1
  - news: 19.0.0
  - nextcloud_announcements: 1.12.0
  - notes: 4.5.1
  - notifications: 2.11.2
  - oauth2: 1.11.0
  - ocsms: 2.2.0
  - password_policy: 1.13.0
  - phonetrack: 0.7.2
  - photos: 1.5.0
  - polls: 3.8.3
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - recommendations: 1.2.0
  - richdocuments: 5.0.10
  - scanner: 0.2.2
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - snappymail: 2.23.0
  - support: 1.6.0
  - survey_client: 1.11.0
  - systemtags: 1.13.0
  - tasks: 0.14.5
  - text: 3.4.1
  - theming: 1.14.0
  - twofactor_admin: 4.0.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_totp: 6.4.1
  - updatenotification: 1.13.0
  - user_ldap: 1.13.1
  - viewer: 1.7.0
  - weather: 1.7.6
  - weather_status: 1.3.0
  - workflowengine: 2.5.0
Disabled:
  - announcementcenter: 6.3.1
  - circles: 0.20.10
  - cospend: 1.4.10
  - dashboard: 7.2.0
  - encryption: 2.8.1
  - federation: 1.0.1
  - integration_google: 1.0.8
  - ldap_write_support: 1.5.0
  - user_status: 1.2.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"Y5KgOXtvGpe_nKSGXP7FrAAAAAg","level":3,"time":"2022-12-09T02:40:57+00:00","remoteAddr":"192.168.40.1","user":"myuser","app":"index","method":"GET","url":"/index.php/apps/maps/contacts","message":"strlen(): Argument #1 ($string) must be of type string, array given in file '/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 74","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0","version":"23.0.12.2","exception":{"Exception":"Exception","Message":"strlen(): Argument #1 ($string) must be of type string, array given in file '/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 74","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1015,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":158,"Previous":{"Exception":"TypeError","Message":"strlen(): Argument #1 ($string) must be of type string, array given","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php","line":74,"function":"strlen"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"getContacts","class":"OCA\\Maps\\Controller\\ContactsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1015,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/maps/lib/Controller/ContactsController.php","Line":74},"CustomMessage":"--"}}

Browser Console

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). moz-extension:42:9
No OC found index.js:46:12
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
JQMIGRATE: Migrate is installed, version 3.3.2 jquery-migrate.min.js:2:708
jQuery is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. globals.js:62:15
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. globals.js:62:15
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
viewer DOMContentLoaded viewer.js:31:8
Object { Search: e()
, Accessibility: {…} }
viewer.js:32:8
oc_appswebroots is deprecated: use OC.appswebroots instead, this will be removed in Nextcloud 20 globals.js:62:15
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
OCA.Viewer initialized Viewer.js:37:25
No OCA.Files app found, viewer is now in standalone mode Viewer.vue:318
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. globals.js:62:15
jQuery is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. 2 globals.js:62:15
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
Proxying an event bus of version 2.1.1 with 3.0.2 ProxyBus.ts:16:20
Loading theming data for notification bell styling App.vue:140
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. globals.js:62:15
Registering notifications container as a menu App.vue:150
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. 2 globals.js:62:15
Notifications permissions denied App.vue:399
Polling interval updated to 30000 App.vue:353
Started background fetcher as session_keepalive is enabled App.vue:215
Proxying an event bus of version 2.1.1 with 3.0.0 index.esm.js:11:20
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
jQuery is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. globals.js:62:15
Proxying an event bus of version 2.1.1 with 1.3.0 index.es.js:2337:14
session heartbeat polling started session-heartbeat.js:101:9
Please do NOT wait for the DOMContentLoaded before registering your viewer handler Viewer.vue:234
viewer DOMContentLoaded viewer.js:34:9
Object { Search: e()
, Accessibility: {…}, Viewer: {…}, Theming: {…}, Maps: {…}, Files: {…} }
viewer.js:35:9
Please do NOT wait for the DOMContentLoaded before registering your viewer handler Viewer.vue:234
Uncaught TypeError: OCA.Files.fileActions is undefined
    <anonymous> viewer.js:68
    EventListener.handleEvent* viewer.js:33
    <anonymous> viewer.js:68
    <anonymous> viewer.js:68
viewer.js:68:3
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. 5 globals.js:62:15
Got notification data App.vue:316
Polling interval updated to 30000 App.vue:353
[DEBUG] unified-search: Unified Search initialized with the following providers 
Object { 0: {…}, 1: {…}, 2: {…}, 3: {…}, 4: {…}, 5: {…}, 6: {…}, 7: {…}, 8: {…}, 9: {…}, … }
ConsoleLogger.js:29:16
Use of the orientation sensor is deprecated. leaflet-src.js:2696:9
Will-change memory consumption is too high. Budget limit is the document surface area multiplied by 3 (341088 px). Occurrences of will-change over the budget will be ignored. klaashome.org
$ is deprecated: The global jQuery is deprecated. It will be removed in a later versions without another warning. Please ship your own. 103 globals.js:62:15
XHRGEThttps://myserver.org/index.php/apps/maps/contacts
[HTTP/1.1 500 Internal Server Error 84ms]

Got notification data App.vue:316
Polling interval updated to 30000

Additional info

No response

tacruc commented 1 year ago

Can you check, if it is reproduceable on a recent maps version e.g. 0.2.5-1-nightly?

jimbolaya commented 1 year ago

Would the Nightly from apps.nextcloud.com for 25 work on 23 or 24?

It will likely be a while until I move to 25. If it works on 24, that might prompt me to move to that

tacruc commented 1 year ago

I don't expect it to work on NC 24 due to the changed design.

Kristoffer99 commented 1 year ago

I can confirm there is a similar bug that I have found. When I open the map, I receive a lot of Failed to send current position AxiosError: Request failed with status code 500 and Failed to save option values: Nextcloud

This application requires JavaScript for correct operation. Please enable JavaScript and reload the page.

Im running nextcloud 25.0.4, maps 0.2.4. I have no contacts only photos enabled

tacruc commented 1 year ago

@Kristoffer99 can you figure out which request is failing. This can be seen in the network tab of the devoloper tools image image image

Just open it reload the page and see which request fails. On Chrome and edge there are similar tools called similar and found in a similar location.

Additionally could you check if this happens on the last nightly

you can install it via occ update maps --allow-unstable

Kristoffer99 commented 1 year ago

Just managed to recreate it. include a screenshot

errors

tacruc commented 1 year ago

Most of the request (right side) are actually the preview, this should be resolved on the nightly. Do you find the request corresponding to the location. Maybe filtering for devices or location could help to identify this.

But I also vaguely remember fixing something like this in the nightly. Maybe testing this would be intressting, too.

Kristoffer99 commented 1 year ago

Do you mean that something is fixed in a newer version of maps then? I cant update to something newer in the version im running right now it seems like.

tacruc commented 1 year ago

Basically the last year of development is only in the nightly. occ update maps --allow-unstable Doesn't update?

jimbolaya commented 1 year ago

The last time I looked at whether I could use nightly I was on 23. It looks like it's there for 24 now and seems to work well for me. Thank you for the suggestion.

tacruc commented 1 year ago

@jimbolaya thanks